in reply to Re^11: Another utf-8 decoding problem
in thread Another utf-8 decoding problem

Even if the browser environment is iso-8859-1?

If you encode to ISO-8859-1, or set up your IO layer as ":encoding(ISO-8859-1)", sure.

Note that I originally asked for the encoding of your terminal, but if this is a CGI script, the "charset" mentioned in the HTTP header counts.

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

Replies are listed 'Best First'.
Re^13: Another utf-8 decoding problem
by DreamT (Pilgrim) on Oct 11, 2010 at 15:58 UTC
    Hi,

    I 'sort of' found the problem, and I guess i 'kind of' didn't pay attention. Now I want to know why:-)

    I encoded the string to iso-8859 using
    $variable = encode("iso-8859-1", $variable);

    If I printed it with
    print "Some text".$variable."Some other text";

    it didn't work. But if I did
    print $variable."Some other text";

    it did work. I guess that this has to do with binmode in some way. But why??
      I guess that this has to do with binmode in some way

      No, it has to do with the fact that some of your strings are decoded, and others (like string literals) not. Please read again the link I gave, you it's all explained there. Yes, I know it's a long read, but it's just not a simple topic.

      Perl 6 - links to (nearly) everything that is Perl 6.
        Ok, I will do my homework ;-). This is really one of my weaker points, so I guess I have to master it to be able to use encoding in Perl in the future. Thanks for all of your help!