from Hex to string

Discussion in 'Ruby' started by Une bévue, Mar 8, 2006.

  1. Une bévue

    Une bévue Guest

    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
     
    Une bévue, Mar 8, 2006
    #1
    1. Advertising

  2. Une bévue

    Mikkel Bruun Guest

    String unpack

    http://ruby-doc.org/core/classes/String.src/M001436.html
    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://DevLists.com. Sign up and save your time!
     
    Mikkel Bruun, Mar 8, 2006
    #2
    1. Advertising

  3. Une bévue

    Gregor Kopp Guest

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

    look at http://www.rubycentral.com/book/builtins.html 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 "
     
    Gregor Kopp, Mar 8, 2006
    #3
  4. Une bévue

    Une bévue Guest

    Une bévue, Mar 8, 2006
    #4
  5. Une bévue

    Une bévue Guest

    Une bévue, Mar 8, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    10
    Views:
    6,223
    Neredbojias
    Aug 19, 2005
  2. Bengt Richter
    Replies:
    6
    Views:
    473
    Juha Autero
    Aug 19, 2003
  3. jack
    Replies:
    4
    Views:
    589
  4. tim

    hex string to hex value

    tim, Nov 22, 2005, in forum: Python
    Replies:
    8
    Views:
    18,879
  5. tim
    Replies:
    2
    Views:
    1,565
    Dennis Lee Bieber
    Nov 23, 2005
Loading...

Share This Page