Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a rather large CSV file (~700MB) which I know to consist of lines of 27-character alpha-numeric hashes; no commas or anything fancy. Somehow, during its migration from Windows to Linux (via winSCP and then a few regular SCPs), it has converted into some kind of binary format I am unfamiliar with.

If I open the file in vi, everything appears fine, and it says [converted] at the bottom, although I know it's not a line endings issue (and dos2unix doesn't help). If I 'head' the file, it looks proper except for a "ÿþ" at the beginning of the first line. If I open up the file in nano, however, I see the "ÿþ" at the start and then "^@" before every character (even newlines and EoF).

If I try to re-save or copy the file (say via: head file.csv > short.txt), this special encoding is preserved. I copied the first ten lines out of vi (which displays it properly) into my Windows clipboard via my SSH client, then pasted it into a new text file, test.txt. This file is visually identical when opened in vi (and similar through 'head', minus the "ÿþ"), although it's roughly half of the filesize. Additionally,

file test.txt
test.txt: ASCII text
file short.txt

I have no idea what format this once-text file got converted to (it's notoriously hard to search the internet for symbols), but surely there must be some way to convert it back. Any ideas?

share|improve this question
It might help to post short.txt somewhere online and link to it so we have a sample to work with. It sounds like some sort of text encoding change (ASCII to UCS-2? just a wild guess) but I couldn't really say for sure without seeing a bit of the data. – David Z Dec 28 '10 at 0:30
up vote 2 down vote accepted

The "ÿþ" could be a Unicode Byte Order Mark (BOM) and the ^@ could be the first byte of each 16-bit Unicode character.

Use recode or iconv to convert it from UTF-16 to ASCII.

share|improve this answer
Thanks a billion! That did the trick with short.txt, although I suspect it's gonna take a little while on the full size data set. – Hammer Bro. Dec 28 '10 at 1:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.