in reply to Re: question about Encode::decode('iso-8859-1', ...)
in thread question about Encode::decode('iso-8859-1', ...)
Whenever you mix a non-decoded (binary, i.e. octets) string with a text string (utf8 flag on), Perl will silently upgrade the binary string, assuming it's in ISO-8859-1 encoding. "Mixing" here refers to actions such as comparing (as with eq), regex matches, concatenation, etc.
Thus, even though the strings $x and $y are different here with respect to their internal representation (as can be shown with Devel::Peek::Dump() — e.g. a0 ($x, binary) vs. c2 a0 ($y, utf8) ), this difference does not show up in the comparison result, because the binary string ($x) is implicitly upgraded for the comparison.
Also, the caveat is talking about decode("utf8",...) (not decode("iso-8859-1",...)), so it doesn't really apply here anyway...
|
|---|