Output comes like this in my XML under SHORT-NAME node "Auch wenn man es nach Jahren guter Besch�ftigung kaum verstehen kan"use XML::SMART; use Encode; my $XML = XML::Smart->new(q`<?xml version="1.0" encoding="UTF-8" ?> <MSR-ISSUE xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan +ce" xsi:noNamespaceSchemaLocation="my.xsd"> </MSR-ISSUE>`, 'XML::Smart::Parser'); my $test_in_incoming_xml = "Auch wenn man es nach Jahren guter Beschäf +tigung kaum verstehen kann"; my $decoded_string = decode("utf8", $test_in_incoming_xml); $XML->{'MSR-ISSUE'}{'SHORT-NAME'}->content(0,$decoded_string); my $xmlfile = "C:\\Temp\\TestFile.xml"; $XML->save($xmlfile, nometagen => 1, forceutf8 => 1);
This prints nothing. When i add a static text to the vriable $sendername the script prints like below#...xml handling... my $XMLRead = XML::Smart->new("C:\\Temp\\TestFile.xml", 'XML::Smart::P +arser'); my $sendername = $XMLRead->{'MSR-ISSUE'}{'SHORT-NAME'}; my $encoded_string = encode("cp1250", $sendername); print $encoded_string;
The output is printed like this#...xml initi... my $sendername = $XMLRead->{'MSR-ISSUE'}{'SHORT-NAME'}; $sendername = $sendername . " Test"; my $encoded_string = encode("cp1250", $sendername); print $encoded_string;
In reply to Re^2: UTF in Perl
by KarthikK
in thread UTF in Perl
by KarthikK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |