H
havel.zhang
hi everyone:
I found XML::Simple can not handling chinese character. for example:
part1.xml:
<?xml version="1.0" encoding="utf-8"?>
<config>
<user>ºÍƽ</user>
<passwd>longNails</passwd>
<books>
<book author="Steinbeck" title="Cannery Row"/>
<book author="Faulkner" title="Soldier's Pay"/>
<book author="Steinbeck" title="East of Eden"/>
</books>
</config>
----------------------------------------
my program:
#!/usr/bin/perl -w
use strict;
use XML::Simple;
use Data:umper;
print Dumper (XML::Simple->new()->XMLin('part1.xml',ForceArray =>
1,KeepRoot => 1));
----------------------------------------
then the result is:
so it's just because of chinese character.
anyone can help me? thank you
havel
I found XML::Simple can not handling chinese character. for example:
part1.xml:
<?xml version="1.0" encoding="utf-8"?>
<config>
<user>ºÍƽ</user>
<passwd>longNails</passwd>
<books>
<book author="Steinbeck" title="Cannery Row"/>
<book author="Faulkner" title="Soldier's Pay"/>
<book author="Steinbeck" title="East of Eden"/>
</books>
</config>
----------------------------------------
my program:
#!/usr/bin/perl -w
use strict;
use XML::Simple;
use Data:umper;
print Dumper (XML::Simple->new()->XMLin('part1.xml',ForceArray =>
1,KeepRoot => 1));
----------------------------------------
then the result is:
not well-formed (invalid token) at line 2, column 8, byte 17 at C:/Perl/site/lib/XML/Parser.pm line 187
so it's just because of chinese character.
anyone can help me? thank you
havel