[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

from Hex to string

pere.noel

3/8/2006 9:11:00 AM

i have datas like that :

646c6532 00000000 61657674 0000012e 00000000 00000000 0000011c 00000004
00000001 00000000 00000000 00000000 [...]
6c6f6e67 00000004 00000000 66726f6d 70736e20 00000008 00000000 005c0001
3b3b3b3b 2d2d2d2d 54455854 00000006 626d6b6d 3a76


seems to be hex encoded US-ASCII (?)

how to convert that in user readable us-ascii ? (to string)

i now i have the sequence "70736e20" which is "psn "
--
une bévue
4 Answers

Stefan Lang

3/8/2006 9:16:00 AM

0

String unpack

http://ruby-doc.org/core/classes/String.src/M0...
On Wednesday, March 08, 2006, at 6:13 PM, wrote:
>i have datas like that :
>
>646c6532 00000000 61657674 0000012e 00000000 00000000 0000011c 00000004
>00000001 00000000 00000000 00000000 [...]
>6c6f6e67 00000004 00000000 66726f6d 70736e20 00000008 00000000 005c0001
>3b3b3b3b 2d2d2d2d 54455854 00000006 626d6b6d 3a76
>
>
>seems to be hex encoded US-ASCII (?)
>
>how to convert that in user readable us-ascii ? (to string)
>
>i now i have the sequence "70736e20" which is "psn "
>--
>une b�vue
>


Mikkel Bruun

www.strongside.dk - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk - Buy Old Stuff!(DK)




--
Posted with http://De.... Sign up and save your time!


Gregor Kopp

3/8/2006 9:31:00 AM

0

a = String.new
a << "70".hex
puts a

look at http://www.rubycentral.com/book/bui... in String


Une bévue schrieb:
> i have datas like that :
>
> 646c6532 00000000 61657674 0000012e 00000000 00000000 0000011c 00000004
> 00000001 00000000 00000000 00000000 [...]
> 6c6f6e67 00000004 00000000 66726f6d 70736e20 00000008 00000000 005c0001
> 3b3b3b3b 2d2d2d2d 54455854 00000006 626d6b6d 3a76
>
>
> seems to be hex encoded US-ASCII (?)
>
> how to convert that in user readable us-ascii ? (to string)
>
> i now i have the sequence "70736e20" which is "psn "

pere.noel

3/8/2006 9:55:00 AM

0

Mikkel Bruun <devlists-ruby-talk@devlists.com> wrote:

> String unpack
>
> http://ruby-doc.org/core/classes/String.src/M0...

thanks !
--
une bévue

pere.noel

3/8/2006 9:55:00 AM

0

Gregor Kopp <gk@cutcopy.com> wrote:

> a = String.new
> a << "70".hex
> puts a
>
> look at http://www.rubycentral.com/book/bui... in String

ok, thanks
--
une bévue