Help for this page

Select Code to Download


  1. or download this
    $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;
    
  2. or download this
      C3 BC
    
  3. or download this
    $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!