These days I'm working with binary data in Perl, so I'm a bit skeptical about such claims. Consider:
my $upper_a = "A";
In $upper_a, the UTF8 Flag is off. All character functions of Perl work on this variable, and that's not only for backwards compatibility. I'd rather call it a text string than a binary string.
If I create a character with $upper_a = "\N{U+41}", then the result has the UTF8 flag on. It behaves in no way different from $upper_a created before.
Binary strings in Perl need careful treatment. Strings where the UTF8 flag is off qualify as binary strings - but these can also be used as character strings. Applying character functions to a binary string might switch the UTF8 flag on. The flag is contagious, one term where the flag is on (even when it is on an character from the ASCII set) is sufficient to have the result carrying the flag. Whether that's a problem depends on whether each position (to avoid the terms "byte" and "character" for the moment) holds a value of less than 256.
If I create an 'ä' as \N{U+E4}, then the UTF8 flag is on. Perl's internal PV is "\303\244" (0xC3A4). But still, it can be treated like a binary 0xE4: It matches /\xE4/, and it can be printed without a "wide character" warning as a single byte.
|