Preventing LibXML from encoding all special characters to their html form?


From what I unsertand, Rails uses by default LibXML.

When doing a to_xml, it encodes all special characters, which is useful for <, &, >, etc. but not really for ü, ô, etc.

First, I can’t convert them back from ɒ to “û” which is very frustrating for my tests.

And I cannot manage to force LibXML not to encode all characters.

Any help? Thanks.

For those who wonder, the same encoding can be applied this way:

require ‘builder/xchar’


And to decode, you can do encoded_string.gsub(/&#([a-f0-9]);/) { |s| [$1.to_i].pack('U’) }

Thank you Builder doc!