Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: DWIM with non ASCII characters

by moritz (Cardinal)
on May 07, 2010 at 07:58 UTC ( #838885=note: print w/ replies, xml ) Need Help??


in reply to Re^2: DWIM with non ASCII characters
in thread DWIM with non ASCII characters

Why use utf8;? As I understand the documentation, its purpose is to enable the source code to be in UTF-8

Yes, that way you avoid concatenating decoded and non-decoded strings.

Of course it requires your script to be actually stored in UTF-8. But since the more general solution (use encoding $your_encoding) is severly broken (wrt to AUTOLOAD, thread safety and other issues), that's currently the only sane way to store non-ASCII Perl programs.

As for the rest, I can only agree to what ikegami wrote; using IO layers is much more convenient than using encode() and decode() on every IO operation. More importantly since there are fewer spots you have to care about encoding, the probability of forgetting it somewhere (and getting Mojibake in response) is much lower.

Perl 6 - links to (nearly) everything that is Perl 6.


Comment on Re^3: DWIM with non ASCII characters

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-07-24 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (157 votes), past polls