![]() |
|
"be consistent" | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
If I'm reading your code correctly, the issue is that in your first case you have a properly formatted Perl string that contains UTF characters, but in the second you have a UTF-8 byte string, not a character string. The difference is discussed a bit in perluniintro and The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!).
By explicitly invoking encode ("UTF-8", ..., the mixed string contains bytes with the high bit set, but not UTF-specific characters. Outputting a byte string as binary is natural, but outputting a Perl string that contains wide characters does not map without specifying an encoding. Does this clarify? If you describe the task you are trying to accomplish, we can probably help with the appropriate set of I/O specifications. #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way. In reply to Re: Unicode strings internals
by kennethk
|
|