NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
My advice… (Score:2)
Always use UTF-8 if you possibly can. It's (more-or-less) a superset of everything else, and it's properly detectable.
If you're looking for interesting encodings, I'd recommend checking out one of the Shift-JIS [wikipedia.org] things. Just for weirdness. Personally, I've little experience of non-western encodings.
For more concrete use cases to cover with encoding, you should look at:
Re: (Score:2)
Can you tell me more about the command line and environment variable problem? I think I'll have the other ones covered, but I'd like to know how you solved that one. I don't recall reading anything about how Perl will treat those.
Sounds like it would be very platform-specific (Score:2)
Reply to This
Parent
Re: (Score:1)
Personally, I'd just pipe those things through Encoding::FixLatin and enjoy the utf8ness it emits :-)
Interesting. I could have used that module a couple of years ago. Since then I've been using this trick to convert UTF-8-or-CP1252 byte strings to UTF-8 text strings:
use Encode qw(decode);use Encode::Guess;my $line = <>;my $utf8 = guess_encoding($line, 'utf8');$line = ref $utf8 ? decode('utf8', $line) : decode('cp1252', $line);http://search.cpan.org/perldoc?POE::Component [cpan.org]