in reply to Re^2: Utf8 experts help!
in thread Utf8 experts help!

the error with Encode::decode('utf8' occurs when it attempts to decode a string read from a file which contains already processed data
There is probably an error in the code that saves the processed data. Do you set any encoding on the output file?

Replies are listed 'Best First'.
Re^4: Utf8 experts help!
by chessgui (Scribe) on Jan 24, 2012 at 14:06 UTC
    Files are written simply by print HANDLE "foo"; (yet in some cases HANDLE is opened in binary mode instead of text mode). On the other hand my prog has grown quite large, has many interacting modules and I can not exclude the possibility that at some point my_decode is called on some fields before saving them to file.

    Still I don't understand why Encode::decode('utf8' does not fail when reading wide characters in the first round only in the second round.

      Still I don't understand why Encode::decode('utf8' does not fail when reading wide characters in the first round only in the second round.

      There was no wide characters in the first round of decoding. You have the string "\320\245\320\260\321\207\320\260\321\202\321\203\321\200 \320\241\321\203\320\263\321\217\320\275", and it only contains characters with values in [0..255]. A wide character is a character with value greater than 255.

      In the light of Anonymous Monk's comment I don't understand how a single time decoded sequence is generated in my prog since decoding takes place only in the 'my_decode' sub (either twice or not at all).