Maybe this is not the right list to address my problem, but it's the only 
place I've seen where I could post my problem, if there's any other 
list/mail/etc. let me know it.

Having this little perl program running (Perl 5.8.0), Perl-Xerces-2.1.0-0 and 
xerces-c 2.1.0

Compiled with the following options:

./runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread


------->8 cut here

#!/usr/bin/perl


###
#
# TEST.xml:
#
#   <?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
#
#   <test>TRA�A</test>
#
###



use XML::Xerces;

### Parse the TEST.xml
$parser = XML::Xerces::XercesDOMParser->new();

eval {$parser->parse ("./TEST.xml")};

XML::Xerces::error($@) if ($@);

### Obtain doc and root node
my $xml_doc = $parser->getDocument();
$node_root=$xml_doc->getDocumentElement();

# Prints

printf "\n-->ORIGINAL TEXT: 
".$node_root->getFirstChild()->getNodeValue()."<--\n\n";

$node_root->getFirstChild()->setNodeValue("Catala");
printf "\n-->ASCII ONLY: 
".$node_root->getFirstChild()->getNodeValue()."<--\n\n";

$node_root->getFirstChild()->setNodeValue("Catal�");

printf "\n-->NON ASCII: 
".$node_root->getFirstChild()->getNodeValue()."<--\n\n";

$node_root->getFirstChild()->setNodeValue("Franca");

printf "\n-->ASCII ONLY: 
".$node_root->getFirstChild()->getNodeValue()."<--\n\n";

$node_root->getFirstChild()->setNodeValue("Fran�a");

printf "\n-->NON ASCII: 
".$node_root->getFirstChild()->getNodeValue()."<--\n\n";


printf "\n-->RESULTING TEXT: 
".$node_root->getFirstChild()->getNodeValue()."<--\n\n";


my $impl = XML::Xerces::DOMImplementationRegistry::getDOMImplementation('LS');

my $writer = $impl->createDOMWriter();

$writer->setEncoding("iso-8859-1");

my $target = XML::Xerces::MemBufFormatTarget->new();
$writer->writeNode($target ,$xml_doc);
printf $target->getRawBuffer();


------->8 cut here

The result I get is:

------->8 cut here

-->ORIGINAL TEXT: TRA�A<--

-->ASCII ONLY: Catala<--


-->NON ASCII: <--


-->ASCII ONLY: Franca<--


-->NON ASCII: <--


-->RESULTING TEXT: <--

<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?><test></test>


------->8 cut here



I loose every non ascii string I write into the XML Nodes, I have no clue nor 
idea to what to do to fix it, I've tried to use the Encode and utf8 perl 
modules without the same results, any help would be really apreciated, 
thanks.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to