Forum: Ruby utf-16 little endian byte order mark with libxml-ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A049c3597983fdaaa2af2b0010c49abc?d=identicon&s=25 Tim Perrett (timperrett)
on 2007-07-25 11:25
Hey all

I am producting an xml file for which is destined to be used by another
application, and after some investigation I have found that there parser
always looks for a BOM at the begining of a file, indicating that the
encoding is UTF-16.

When I call @document.encoding = 'utf-16' on my xml document it does
appear to attach the BOM to the begining of the file, but then doesnt
output the rest of the xml?! If I change back to utf-8 everything works
perfectly fine. Has anyone done any utf-16 parsing/creation with libxml
before?

The characters used as the BOM are "ÿþ" (<Latin small letter y with
diaeresis, Latin small letter thorn>, <U+00FF U+00FE>).

Any help would be great

Cheers

Tim
A049c3597983fdaaa2af2b0010c49abc?d=identicon&s=25 Tim Perrett (timperrett)
on 2007-07-25 14:50
It appears that the save() method on XML::Document will create files if
none exsist and add the bom for you :) brilliant!!
- Tim
This topic is locked and can not be replied to.