Files display only ^@^@^@^@

I have some files I was hoping to open and look at. I usually open files of the same extension them on a server in a UNIX environment. These files as far as I can tell have been plain text but attempting to open this particular set with nano on my Mac displays the following ^@^@^@^@^@^@.... Is there a way to change the encoding so I can read them? Also the files are old and some that I do not believe should be empty are empty, is there a good test to see if they are corrupted?

Update: Moving the folder onto the UNIX server does not fix this issue. Contents are still ^@^@^@^@^@....


ASCII values lower than 32 are often displayed in Unix text environments as ^@, ^A, ^B... and so on. Thus, ^@ represents ASCII character 0, ^A represents 1, etc. (So, when you type CTRL C, you're actually sending ASCII 3.)

If the file reads entirely of ^@ in nano, then the file is 'zeroed' and contains no useful data. Time to check the backup.


File extensions can usually suggest the type of contents a file might have, however, sometimes files are misnamed, and sometimes files are corrupted. I presume that if you're accustomed to opening filenames with a similar extension with a text editor like nano, you're expecting this file to be plain text as well.

Give the command 'file' a try; that could tell you what the contents are. Also, if it's mixed text and data, the command 'strings' can help pull out some interesting text in an otherwise unreadable (to the eye) file.