Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: XML::Smart and UTF-8

by ikegami (Pope)
on Jun 21, 2014 at 06:57 UTC ( #1090730=note: print w/replies, xml ) Need Help??


in reply to XML::Smart and UTF-8

1. It's so so wrong, but you need to encode the data before passing to to XML::Smart. You seem to be doing that already.

2. You need to pass decode => 1 to save.

use strict; use warnings; use Encode qw( encode_utf8 ); use XML::Smart qw( ); my $text = chr(0xC9); my $utf8 = encode_utf8($text); my $doc = XML::Smart->new('<?xml version="1.0" encoding="UTF-8"?><root +></root>'); $doc->{root}{node}{CONTENT} = $utf8; $doc->save('a.xml', decode=>1);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090730]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2019-02-19 21:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I use postfix dereferencing ...









    Results (105 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!