in reply to XML:: DOM and Accented Characters
It seems the printToFile method has not been written with unicode in mind1... but you could create a properly UTF-8-encoding file handle yourself, and then either use ->printToFileHandle, or simply ->print
... open my $fh, ">:utf8", "accentTestOutPut.xml" or die $!; # Print doc file $doc->printToFileHandle($fh); # or $doc->print($fh);
$ hexdump -C accentTestOutPut.xml 00000000 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 |<?xml ver +sion="1| 00000010 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 |.0" encod +ing="UT| 00000020 46 2d 38 22 3f 3e 0a 3c 54 45 53 54 3e 20 c3 a9 |F-8"?>.<T +EST> ..| 00000030 20 3c 2f 54 45 53 54 3e 0a | </TEST>. +| ^^^^^
___
1 current implementation:
sub printToFile { my ($self, $fileName) = @_; my $fh = new FileHandle ($fileName, "w") || croak "printToFile - can't open output file $fileName"; $self->print ($fh); $fh->close; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: XML:: DOM and Accented Characters
by freeflyer (Novice) on Aug 06, 2010 at 14:12 UTC | |
by almut (Canon) on Aug 06, 2010 at 14:36 UTC | |
by graff (Chancellor) on Aug 06, 2010 at 17:03 UTC | |
by freeflyer (Novice) on Aug 07, 2010 at 10:09 UTC | |
by Pickwick (Beadle) on Aug 07, 2010 at 15:26 UTC | |
by freeflyer (Novice) on Aug 07, 2010 at 18:07 UTC | |
| |
by Anonymous Monk on Aug 07, 2010 at 11:41 UTC | |
by freeflyer (Novice) on Aug 07, 2010 at 12:14 UTC | |
|
In Section
Seekers of Perl Wisdom