Computing.Net > Forums > Unix > binary to ASCII

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

binary to ASCII

Reply to Message Icon

Name: Brian
Date: August 27, 2003 at 12:50:22 Pacific
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?



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: August 27, 2003 at 18:59:31 Pacific
Reply:

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.


0

Response Number 2
Name: Brian
Date: August 28, 2003 at 10:02:35 Pacific
Reply:

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


0

Response Number 3
Name: anonproxy
Date: August 28, 2003 at 10:52:39 Pacific
Reply:

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



0

Response Number 4
Name: peter4u
Date: August 30, 2003 at 14:50:34 Pacific
Reply:

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.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: binary to ASCII

convert a binary file to ascii www.computing.net/answers/unix/convert-a-binary-file-to-ascii/6213.html

Sending attachments in UNIX www.computing.net/answers/unix/sending-attachments-in-unix/2078.html

Binary sort www.computing.net/answers/unix/binary-sort/4717.html