[libxml-devel] problem with UTF-16 encoding

Tim Perrett hello at timperrett.com
Mon Nov 26 16:05:38 EST 2007


Hey Chaps

There seems to be some kind of issue with UTF-16 encoding in libxml- 
ruby version 0.5.2.0.

When I do this:

doc = XML::Document.new()
# doc.encoding = 'utf-16'
doc.root = XML::Node.new('root_node')
root = doc.root
puts doc
## => <?xml version="1.0"?><root_node/>

Uncomment the encoding however and you get this:

doc = XML::Document.new()
doc.encoding = 'utf-16'
doc.root = XML::Node.new('root_node')
root = doc.root
puts doc
## => ÿþ<

Any idea whats going on here and how to fix it? The encoding features  
used to work no problem at all. Im running ruby 1.8.6 (2007-06-07  
patchlevel 36) [universal-darwin9.0]

Cheers

Tim




More information about the libxml-devel mailing list