Computing.Net > Forums > Unix > binary to ASCII

binary to ASCII

Reply to Message Icon

Original Message
Name: Brian
Date: August 27, 2003 at 12:50:22 Pacific
Subject: binary to ASCII
OS: MS 2000
CPU/Ram: 2.40/523
Comment:

Does anybody know how to convert data from 2-byte binary format into ASCII format for viewing?


Report Offensive Message For Removal

Response Number 1
Name: Don Arnett
Date: August 27, 2003 at 18:59:31 Pacific
Subject: binary to ASCII
Reply: (edit)

What OS is MS 2000??

On a UNIX or Linux system, you should have a utility named 'od'.

"od -c filename" should display the file as ascii characters where possible.

But a byte value can range from 0 to 255 and ASCII characters are defined only from 0 to 127 and not all of those are printable characters. I don't remember how "od -c" will display non-ascii values.


If you just want to see the values of the bytes (not necessarily as ASCII characters), you can use:

od -x filename

This will display the hex values of the bytes. There are other options also.


Report Offensive Follow Up For Removal

Response Number 2
Name: Brian
Date: August 28, 2003 at 10:02:35 Pacific
Subject: binary to ASCII
Reply: (edit)

Those commands may be useful, but what I'm really trying to do is compile c code in UNIX which can convert a binary datafile to ASCII. From there, I can use winRAR to extract the data for viewing. Any thoughts on this are welcome...thanks


Report Offensive Follow Up For Removal

Response Number 3
Name: anonproxy
Date: August 28, 2003 at 10:52:39 Pacific
Subject: binary to ASCII
Reply: (edit)

Look at this:
http://frodo.whoi.edu/aer/twob_conversion.html



Report Offensive Follow Up For Removal

Response Number 4
Name: peter4u
Date: August 30, 2003 at 14:50:34 Pacific
Subject: binary to ASCII
Reply: (edit)

Binary to ascii is not really defined.

If you are talking about 2-byte unicode, there may be a special tool reading that.

If you are talking about moving files using FTP, there is the issue of binary files versus ascii files because of the different representation of "the new line" in unix and in windows. UNIX uses just a "linefeed" and windows uses "linefeed" and "carriage return".

So, if you made the mistake to download a test file (or html etc.) in binary format from a UNIX based server, it would not display right in windows. You could fix this with ftp in pumping it up binary and back down in ascii, or you could use tr or an editor to replace each "linefeed" by "linefeed carriage return"

So, what exactly is your issue?

If you just want to look for printable characters in some executables, octaldump "od -c filename" or "strings filename | more" will do it.



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: binary to ASCII

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software