XML::DOM Encoding UTF-8 and ISO-8859-1
From: Addy (aclaure_at_zethon.net)
Date: 02/18/04
- Next message: Ron Parker: "Re: Posting Usenet News Messages"
- Previous message: Eric Schwartz: "Re: more stripping"
- Next in thread: Alan J. Flavell: "Re: XML::DOM Encoding UTF-8 and ISO-8859-1"
- Reply: Alan J. Flavell: "Re: XML::DOM Encoding UTF-8 and ISO-8859-1"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Feb 2004 11:54:52 -0800
I'm a little confused as to why I'm getting these results. Consider
the XML file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<foo>
<string>Sécurité</string>
</foo>
Through a CGI script, I load up the file, grab the encoding and put in
the CGI header:
my ($parser) = new XML::DOM::Parser();
my ($doc) = $parser->parsefile('foo.xml');
my ($encoding) = $doc->getXMLDecl()->getEncoding();
print header(-charset => $encoding);
However, when I traverse through the XML and print out the above
"string" element, I see grabled text like "Sécurité"
If I change the CGI header encoding to UTF-8 like such:
print header(-charset => 'UTF8');
The text shows up properly. It would seem to me that the text would
show up properly by using the same encoding on the HTML page as is in
the XML file. This is the case when using other encodings, namely
'x-sjis-cp932'.
Could someome help me understand what I'm overlooking?
Thank you,
Addy
- Next message: Ron Parker: "Re: Posting Usenet News Messages"
- Previous message: Eric Schwartz: "Re: more stripping"
- Next in thread: Alan J. Flavell: "Re: XML::DOM Encoding UTF-8 and ISO-8859-1"
- Reply: Alan J. Flavell: "Re: XML::DOM Encoding UTF-8 and ISO-8859-1"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|