A
Addy
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:OM:arser();
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
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:OM:arser();
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