in reply to Re: UTF in Perl
in thread UTF in Perl
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: UTF in Perl
by moritz (Cardinal) on Oct 10, 2008 at 14:41 UTC | |
by KarthikK (Sexton) on Oct 10, 2008 at 14:56 UTC | |
by moritz (Cardinal) on Oct 10, 2008 at 15:07 UTC | |
by KarthikK (Sexton) on Oct 13, 2008 at 07:16 UTC |