in reply to String to UTF-8

Use unpack with a template of U*, or split $str and use map with ord:

local $, = ' '; local $\ = "\n"; print unpack 'U*', $str; print map ord, split //, $str;

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Replies are listed 'Best First'.
Re^2: String to UTF-8
by Baz (Friar) on Sep 25, 2004 at 14:03 UTC
    PrintUnicodeString($str); PrintUnicodeString{ join("", map { printf("\\x{%04X}", $_) # \x{...} } unpack("U*", $_[0])); # unpack Unicode characters }