Click here to get back home

unicode <-> hex

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
unicode <-> hex nazrat 02-18-2008
`--> Re: unicode <-> hex Joost Diepenmaa...02-18-2008
Get Chitika Premium
Posted by nazrat on February 18, 2008, 6:07 am
Please log in for more thread options
i'd like to know if there's a way to get back the original hex values
of a unicode character.
ex:
my $u = "\x";
my $h = pack(....., $u) ? so that $h is now a string '20A3'. thanks.

Posted by Joost Diepenmaat on February 18, 2008, 6:17 am
Please log in for more thread options

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

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/

Similar ThreadsPosted
unicode: é=>e, á=>a February 23, 2005, 12:23 pm
unicode July 5, 2006, 8:25 am
LWP and Unicode October 2, 2006, 4:59 am
output becomes unicode September 3, 2004, 4:02 am
Re: output becomes unicode September 3, 2004, 4:27 am
unicode support January 9, 2005, 1:28 am
Unicode datasend October 10, 2005, 9:49 pm
unicode string March 1, 2006, 5:27 am
unicode conversion March 20, 2006, 12:09 am
Unicode and Perl August 1, 2006, 9:34 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap