How to read ANSI encoded files in the right way?
I have some files that Ubuntu can't read it ( ANSI encoding ) but Windows can read it well.
When I open it in gedit or notepad++ it seems like this :
Êã ÇáÊÍæíá áÜÜ
How can I make Ubuntu read ANSI encoded files well?
Solution 1:
ANSI means more or less nothing --- the most probable candidate for your encoding is Windows-1252. You can convert the file with
iconv -f WINDOWS-1252 -t utf8 < filein.txt > fileout.txt
but remember, most encodings (read the linked article if you are not sure about what that mean) can't be reliably guessed, so you need to know the exact encoding to give sense to your data.
From the comments it seems that you are most probably looking for some Arabic encoding --- in that case check WINDOWS-1256
.
The list of available encodings for iconv
is on github, or you can find it with the command
iconv --list
Notice that just at the start of the list there are a bunch of "ANSI"-like encodings.
Solution 2:
If you don't want to convert it as mentioned in Rmano's answer, you may use Geany or Kate to read/edit them ar they are, default Arabic encoding in Windows is CP-1256 (WINDOWS-1256
). Just keep in mind that switching to UTF-8 is recommended over all. It is supported by Notepad++ and Windows default note editor.
Geany
sudo apt-get install geany
Kate
sudo apt-get install kate