unicode <-> hex

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
i'd like to know if there's a way to get back the original hex values
of a unicode character.
my $u = "\x";
my $h = pack(....., $u) ?  so that $h is now a string '20A3'.  thanks.

Re: unicode <-> hex

Quoted text here. Click to load it

my $h = sprintf("%X",ord($u));

There's probably some way to do this using (un)pack, but I doubt it's much
more efficient if you're going at it char-by-char.

Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl /

Site Timeline