Manoel
Manoel

Reputation: 33

HEX 00 value between characters

I have a file here that contais some texts, and I want edit them. But between the characters have a decimal value 00. If I remove it, gives erros in the file and nothing appears in the program! But if I edit keeping the 00 values ​​between the letters, it works. Have a program that "hide" these values? By this mode, it is very difficult for me to edit so many letters one by one in a file of 13 MB! Here goes a print:
http://img211.imageshack.us/img211/2286/fsfsz.png
What can I do? Thanks all in advance!

Upvotes: 1

Views: 14184

Answers (2)

zakinster
zakinster

Reputation: 10698

Your file looks like an UTF-16 text file, it means each character is coded in 16 bits instead of 8 bits. If you try to edit this file as a standard text file, you get null characters between each letters.

You can use libiconv to convert the file format, or you can write your own converter.

Using iconv :

iconv -f UTF-16 -t UTF-8 yourFile.txt > fileToEdit.txt

iconv -f UTF-8 -t UTF-16 editedFile.txt > programFile.txt

If you're on Windows, you can use the MinGW distribution of libiconv.

Upvotes: 2

Rushyo
Rushyo

Reputation: 7604

The file is encoded in Unicode. UTF-16, most likely. If you open it in a decent text editor (e.g. Notepad++) it will automatically detect this and allow you to change the encoding. However, 'the program' (whatever that is) probably wants to consume the file with UTF-16 encoding. It's not clear why you're trying to change it but the answer is probably keep the 00s.

Upvotes: 0

Related Questions