in reply to Re: Different behaviour in characters in string vs. array?
in thread Different behaviour in characters in string vs. array?

encoding has problems, which is why I recommended use utf8;

Replies are listed 'Best First'.
Re^3: Different behaviour in characters in string vs. array?
by ccn (Vicar) on Dec 10, 2008 at 21:45 UTC

    Good point.

    So to avoid encoding bugs and warnings at output about "Wide character in print" one can write:

    use utf8; $ENV{LANG} = 'ru_RU.UTF-8'; use open IO => ':locale'; # I tried ':utf8' instead but got warnings

      The bugs to which you linked are Encode's, not encoding. While they may effect use encoding, I was referring to use encoding's proper flaws. Now, I can't remember exactly what they were, but you can search the P5P mailing list for the conversation.

      Depending on what you want to do,

      # Use expected encoding for STDIN/OUT/ERR use open ':std', ':locale'; # Use UTF-8 for STDIN/OUT/ERR use open ':std', ':encoding(UTF-8)'; # Use UTF-8 for file IO use open IO => ':encoding(UTF-8)';

      :utf8 has a security vulnerability for input.