Help for this page
$x = "\xFC"; # ISO-Latin-1: 1 byte $x .= pack 'U0'; # append a zero length UTF-8 string ... # hex dump: local($\, $,) = ("\n", " "); print map { sprintf "%02X", $_ } unpack 'C*', $x;
C3 BC
$l1 = pack 'C0a*', $s; # copies the bytes out of $s and marks the r +esult as non-UTF-8 $u8 = pack 'U0a*', $s; # copies the bytes out of $s and marks the r +esult as UTF-8 -- even if the bytes don't form proper UTF-8 strings!