Without seeing your code and the source documents, I can only guess. But here's my guess.
` is hex for "carriage return", as in hex 0D and part of the common line terminator in the Windows world. It can be seen when "canonicalizing" documents with CRLF line terminators (i.e., Nokogiri::HTML::Document#canonicalize), is that how you're serializing?
#! /usr/bin/env ruby
html = <<-EOXML
<element foo="asdf\r\n">this has a CR and a LF at the end of it\r\n</element>
">this has a CR and a LF at the end of it