what to do with special characters like "é","ë",...

L

lievemario

hey,

I've wrote a perl script which gets data out of a mysql database and convert
it to xml.
It works with the XML::Handler::YAWriter,
here is the code;

use strict;
use DBI;
use XML::Generator::DBI;
use XML::Handler::YAWriter;
my $dbh = DBI->connect ("DBI:mysql:myDB", "myUID", "myPassword",
{ RaiseError => 1, PrintError => 0});
my $out = XML::Handler::YAWriter->new (AsFile => "test.xml");
my $gen = XML::Generator::DBI->new ( Handler => $out, dbh => $dbh );
$gen->execute ("SELECT *

FROM someTable");
$dbh->disconnect ();

I do not get any errors when executing the script,
but when I try to open the test.xml file, it has an error
in it:
<name>th?/name>
this should be:
<name>thé</name>

Has anyone an idea how I can solve this?

thx!
 
J

Jürgen Exner

lievemario wrote:
[...]
I do not get any errors when executing the script,
but when I try to open the test.xml file, it has an error
in it:
<name>th?/name>
this should be:
<name>thé</name>

Has anyone an idea how I can solve this?

Just use the proper encoding/character set/code page (terminology varies),
either in your database or in the generated XML file or in the XML header or
in the settings for whatever program you are using to "open" the XML file.
Actually change those "or" to "and". Although you could convert the charset
from and to it is much easier to stick to the same throughout.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,050
Members
48,769
Latest member
Clifft

Latest Threads

Top