$x = "\xFC"; # ISO-Latin-1: 1 byte $x .= pack 'U0'; # append a zero length UTF-8 string # which will turn the whole thing into UTF-8! # 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 result as non-UTF-8 $u8 = pack 'U0a*', $s; # copies the bytes out of $s and marks the result as UTF-8 -- even if the bytes don't form proper UTF-8 strings!