You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Christian Orsatti <or...@istar.fr> on 2003/10/30 18:31:36 UTC

setEncoding function

Hi

An other problem that I face.
I can't set the encding to "ISO-8859-1"
It is always "UTF-16"
Why ?

My code is:
my $impl = 
XML::Xerces::DOMImplementationRegistry::getDOMImplementation("LS");
#### Create a DOM writer
my $serializer = $impl->createDOMWriter();
$serializer->setEncoding("$XML::Xerces::XMLUni::fgISO88591EncodingString");

my $dt = eval{$impl->createDocumentType('PhysicalEntity', 'no', 
'PhysicalEntity.dtd')};
($@) and die ($@);

my $doc = eval{$impl->createDocument('', 'PhysicalEntity',$dt)};
($@) and die ($@);

$doc->setEncoding("\*XML::Xerces::XMLUni::fgISO88591EncodingString");
my $str = $serializer->writeToString($doc);

print STDERR "\n\n$str\n\n";

and I have the result:

<?xml version="1.0" encoding="UTF-16" standalone="no" ?><!DOCTYPE 
PhysicalEntity PUBLIC "no" "PhysicalEntity.dtd"><PhysicalEntity/>

I have try alse set ActualEncoding but it change nothing

thanks for your help

Christian



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org