Unicode to Hex - Pack possibly?

Matt Lawrence matt.lawrence at virgin.net
Fri Apr 17 17:02:19 BST 2009


James Laver wrote:
> On 17 Apr 2009, at 16:11, abhishek jain wrote:
>
>> Hi,I need to convert a text written in Devanagari (Hindi) Language into
>> Hexadecimal language.
>> I know we can do in perl , possibly with pack / unpack but not how to 
>> do so
>> Can anyone here help?
>
> You're going to have to be a bit more specific than that. What are you 
> trying to achieve? To represent each byte as two hex digits? To 
> convert all numbers in the text into hex digits?

Oddly, this reply arrived before the original message (still pending)

This *might* be what you want:

@hex = map { unpack("H*", pack("U", ord)) } split("", $string);


Matt



More information about the london.pm mailing list