Slash Boxes
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Seeing as you didn't ask for it. ;-)

    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 [] 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:

    • query parameters coming in from browsers
    • POSTed form parameters coming in from a browser.
    • What e
    • 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.

      • Command line arguments come in as raw bytes. So you have to detect the codeset of the user's environment and encode if necessary. Roughly like this:

        use I18N::Langinfo qw(langinfo CODESET);
        use Encode qw(decode);
        my $codeset = langinfo(CODESET);
        for (@ARGV) { $_ = decode $codeset, $_ }

        Likewise for environment variable values.