Why? Browser can translate &#xxxx; into Chinese, but I want to get the real UTF-8 Chinese characters. Please kindly help, thanks!
on 2007-05-14 07:26
on 2007-05-15 05:26
It's built into Builder::XmlMarkup. You can run a transform on the returned XML to un-escape characters that are encoded into numbers. This assumes that all characters from emitted from #to_xml were Unicode. def unescape_numeric_entities(xml) xml.gsub(/&#(\d+);/) do |c| [$1.to_i].pack("U") rescue c end end unescape_numeric_entities(record.to_xml)
on 2007-05-15 09:45
Thank you very much!