XML::Simple encoding problem

From: Ed Waldspurger (ewald_at_electronicfrontiers.com)
Date: 06/30/04


Date: Wed, 30 Jun 2004 17:58:06 GMT

I am having a problem displaying data read in using XML::Simple. I am
reading in the data, and then displaying it on a web page. The data has
a é (lowercase e acute) in it, this is the character that is not being
displayed properly.

Here is the contents of the XML file.

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<Location>
        <LocationName>Northside Café</LocationName>
</Location>

Here is a link to the XML file.
<http://www.certifichecks.com/biz/test.xml>.

After reading the xml data in, the e acute is being displayed as the A
tilde and copyright characters (in my browser at least). Here is the
code snippet that reads the xml file and then displays the data. I am
using CGI.pm to create the output.

my $xmlref = XMLin('test.xml');

print $cgi->pre( dump($xmlref) );
print $cgi->h2("Location Name: $xmlref->{'LocationName'}");

You can see the output of the script here.
<http://www.certifichecks.com/cgi-bin/xml_test.pl>

I'm not sure if the problem is in the XML file itself, when XML::Simple
reads the data in, or when I try to display the data on the web page.
Where is the actual problem, and how do I display the data properly?

I am running Perl 5.6.1 on FreeBSD 4.4

Thank You
Ed Waldspurger



Relevant Pages

  • RE: XML file displaying error
    ... > i have some problem in displaying xml file in asp.net, ... > Unexpected XML declaration. ... > Sub page_load ...
    (microsoft.public.dotnet.framework.aspnet)
  • XML file displaying error
    ... i have some problem in displaying xml file in asp.net, ... Unexpected XML declaration. ... Sub page_load ... And follwing is my xml file displaying code: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Return XML in function
    ... Dim myXml As XmlDocument = New XmlDocument ... Instead of displaying, in the browser, the resulting XML I want to ... return it so I can display it later in the browser as a XML document. ... I don't think you can guarantee the way in which the browser will handle the XML file. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Saving XmlDocument object to client computer as a file
    ... How are you displaying it? ... Are you sending the XML file as XML file to the ... an XmlDocument object. ... > XmlDocument as a file without creating an XML file on the server. ...
    (microsoft.public.dotnet.xml)
  • Re: quick startup in displaying wavefront OBJ files with OpenGL
    ... So, I am after displaying the data in a 3D OBJ file, not reading it ... Additional it can store normals and/or tex-coords. ...
    (comp.graphics.api.opengl)