From: Bob Hutchison Date: 2001-11-11T23:26:14+09:00 Subject: [ruby-talk:24877] Re: XML libraries (Re: Re: ruby and webservices) On 01/11/11 2:20 AM, "TAKAHASHI Masayoshi" wrote: > > Hmmm... > I made a patch for nqxml-1.1.1(see below). This patch has a problem: > it's correct only for the document's encoding is UTF-8. > > IMHO, default encoding of XML parser in Ruby should be UTF-8. > Because XML is in Unicode world, not ISO-8859-* nor EUC world > (unfortunately for me). And Ruby's regex doesn't support > UTF-16. > So, if the parser support only one encoding, it should be UTF-8, > and documents in other encoding should be converted to UTF-8. > > Is it good solution? No I don't think so. How you represent the character stream internally is entirely up to you (immediate *internal* conversion to UTF-8 by your parser is OK). Restricting input to UTF-8 will place an impossible to live with constraint on the use of your parser. Presumably having an XML parser is to allow ruby programs to participate in a larger context -- and this larger context isn't going to provide encoding conversions. Bob