Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Lost in encoding in Twig

by Anonymous Monk
on Jan 09, 2015 at 14:22 UTC ( #1112750=note: print w/replies, xml ) Need Help??


in reply to Lost in encoding in Twig

So my question : who has corrupted Clémence ?
As far as I can tell, XML::Twig::print did. It seems to me (from your post) the problem goes away with keep_encoding => 1?
sub print { ... if($perl_version > 5.006 && ! $t->{twig_keep_encoding}) { if( grep /useperlio=define/, `$^X -V`) { binmode( $fh || \*STDOUT, ":utf8" ); } } ...
Since you didn't use utf8; in your code, Clémence is not utf-8 (for Perl's purposes). Printing it to utf-8 filehandle will wreck Clémence.

Also I don't understand what utf-8 has to do with Perl 5.018 in particular

Replies are listed 'Best First'.
Re^2: Lost in encoding in Twig
by pcouderc (Monk) on Jan 09, 2015 at 15:03 UTC
    Thank you,
    I thought to have seen somewhere that since something like 5.16 use utf8 wad the default.
      I thought to have seen somewhere that since something like 5.16 use utf8 wad the default.
      Unfortunately, no.

      from your other post

      do you want to tell that for each operation in perl, and particularly for IO, I MUST specify utf8?
      Yes.
      Is there today another coding than utf8?
      Yes, but utf-8 surely would be a more useful default.
      Is not it possible to specify that all is utf8 (unless exceptions) at computer level ? or at least at perl level, or at least at script level ?
      Perhaps utf8::all will be suitable for you.
        utf8::all seemed very fine but ... does not work !
        Same result...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-12-01 06:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?