About the target file for russian, pasting the file corrupts the encoding, I'll try to upload the file. Pasting, just to let you know the schema used:#!/opt/perl/5.8/bin/perl -I /fw/subsystems/loc/tools/loca/mod/ # /fw/subsystems/loc/tools/loca/OLDDB_to_LOCA.pl use lib "/fw/subsystems/loc/tools/loca/mod/"; use strict; use Encode; use XML::XPath; use XML::XPath::XMLParser; my %SubstituteHash; my $SourceHash; my $import_xp = XML::XPath->new(filename => "russian_test.xml"); open (XML_DIFF_FH,"> test_o.xml") or die "$!"; binmode XML_DIFF_FH, ":utf8"; print XML_DIFF_FH "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Transl +ation>\n"; my $import_xp_nodeset = $import_xp->find("/Translation/String"); foreach my $import_xp_node ( $import_xp_nodeset->get_nodelist ) { my $CurrentStringId = $import_xp_node->findvalue("\@name"); $SourceHash->{$CurrentStringId} = $import_xp_node->findvalue("val +ue[\@language!=\"English\"]/text"); $SourceHash->{$CurrentStringId} = pack ("U*", unpack("C*", $Source +Hash->{$CurrentStringId})); print STDERR Encode::is_utf8($SourceHash->{$CurrentStringId})?"1": +"0"; $import_xp->setNodeText("/Translation/String[\@name=\"$CurrentStri +ngId\"]/value[\@language=\"English\"]/text", $SourceHash->{$CurrentStringId} ); print XML_DIFF_FH XML::XPath::XMLParser::as_string($import_xp_node +) . "\n"; print XML_DIFF_FH "<test>" . $SourceHash->{$CurrentStringId} . "</ +test>\n"; } print XML_DIFF_FH "</Translation>"; close XML_DIFF_FH;
Well, I wasn't able to know How to upload a file, I'll upload the file under teh following link: Source file: http://www.losinguanzo.com/utf8/russian_test.xml The file generated with this script: http://www.losinguanzo.com/utf8/test_o.xml The pasted script: http://www.losinguanzo.com/utf8/test.pl Thanks a lot for your help. Inguanzo<?xml version="1.0" encoding="UTF-8" ?> <Translation> <String name="cprtConsoleYES" translate="yes" ID="137856" context="YE +S button prompt for PML messages."> <sizing type="LynxOS" height="0" width="0" font="CP" fontSize="10.5" + bold="0" /> <value language="English"> <text>test</text> </value> <value language="Russian"> <text>Да</text> </value> </String> </Translation>
In reply to Re^2: Using a variable with UTF8 content coming from XPATH findvalue
by inguanzo
in thread Using a variable with UTF8 content coming from XPATH findvalue
by inguanzo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |