Converting hexadecimal to text in python

Discussion in 'Mac Programming' started by patent10021, Jul 22, 2017.

  1. patent10021, Jul 22, 2017
    Last edited: Jul 22, 2017

    patent10021 macrumors 68030

    patent10021

    Joined:
    Apr 23, 2004
    #1
    I've tried chardet but had no luck.

    Btw, is this simply hexadecimal or are there variations I need to know for python conversion?
    --- Post Merged, Jul 22, 2017 ---
    I pasted the hex into an online vanilla converter and got 2 types of text returned in the same file.
    I'm assuming the original documentation plain English text was converted successfully but any code i.e. Python, R, Java was still garbled?


    Some looked like this:
    Code:
    6B´ƒ>Ãþ·>=OP>{°Í½øÔ!¾°ÈȽ€½Ç(A¾jI¾Ù?êŸ-?(çí>i쾐̊¾ì<¾ñtV¾€’í¾ÓPå¾2¡>ŽÜ>mt >›ä¾}X¾
    ò½O}꽉ð}¾ég¾Ùʝ»ŠR@9Sþº2–½—£#¼ÇpÜ»·Lä¾)óÔ¼&<S¥;ñ™§<J¦»J?¾¤w„<‡ÊC<‘ò¿ú¼a;õW<¤Ú;!‘S<OõS=5ùR=@WŽ;nÐý½æK‘=é¸<s׶=Cñ=R”–=7&>}–>‘^>žü•¾‚Ò¾>Óv¾hîA>ñb>4E!>PIJ>6¤Þ>Ëa´>„ìÿ¾42,¿·¨Ð¾¥aJ;Ɲ½‚v˽@w/>)K¨>œb>>x,¾¾â‰¾di
    
    ¾ãÀ,>÷>>¤$±=«?>àk=>·Ô=T3>Þí>Hes=l¬¾¯Lº¾FM¾9s¾ä5Ͼľ~D¾Ñ"1¾ûËV=-H>    S>TÌ=ZÇi>ôåq>äY=wÑ6==½·¥½ÝF>§ûؼk1¾ù4H=5=£-G½À²¾ø:+<¤ž>úÄÔ≯½ß¾øë3=\—+>c^½Í>ò¾´¼óMÛ>wå†>$¤3½$³ˆ¾æ‡d=Ά¼=ŊŒ½3\ª¾Î¿g¼$€¡>±ï9¾º¾b¿'¾j=KI ;‰žÞ½©>e³0>oh>ü~½†¼†žH=û¼?>ސ=¢Q¢½®4"¾¯ñó½>< =m ‰>aË>Ñ8¶>µ¹t>·Ì.>r]ǼWÜ¿u
    
    Some looked like this:
    Code:
    tench, Tinca tinca
    goldfish, Carassius auratus
    Sgreat white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias
    tiger shark, Galeocerdo cuvieri
    hammerhead, hammerhead shark
    *electric ray, crampfish, numbfish, torpedo
    stingray
    cock
    hen
    ostrich, Struthio camelus
    #brambling, Fringilla montifringilla
    goldfinch, Carduelis carduelis
    )house finch, linnet, Carpodacus mexicanus
    junco, snowbird
    ;indigo bunting, indigo finch, indigo bird, Passerina cyanea
    )robin, American robin, Turdus migratorius
    bulbul
    jay
    
     

    Attached Files:

  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    What is the origin of the hex data? Please be specific.

    Do you know what character-set it's supposed to be? Much of it looks like ASCII, but some doesn't. It's not UTF-8, either.

    If the data is in a file, please post the file. Screenshots have little value for performing analysis.

    The screenshot you posted has some sequences that look really odd to me. The bytes with values 1c, 1a, 12, 04, 02, (anything in range 00-1f, except 0a (which may be newline) don't look like reasonable text to me. Any byte whose value is 7f or higher (e3, e6) is also strange.

    There's a slim possibility that the bytes outside the range 0x20-ox7e could have a special purpose in some arcane text format. This is why knowing the origin of the data is important. If it's from a data file originating in the 1960's, or an extract from a binary file dump, then that's important context for figuring it out.
     
  3. patent10021 thread starter macrumors 68030

    patent10021

    Joined:
    Apr 23, 2004

Share This Page