How to read ANSI encoded files in the right way?
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
Solution 3
The gedit can work with files encoded with e.g. Windows-1250. Select "Open", "Additional Documents", Character encoding: "Central European (WINDOWS-1250"). If it is not there, add it there by this option.
Related videos on Youtube
user.dz
Started using Debian in 2006, Totally switch from Windows to Ubuntu in 2008. Up's & Down's...Whatever Little background on shell,c,c++,html,css,python...(electronics || computer) && (FREE as free speech) Call me Mr./I/You/He/We/They, I respect She/Mrs./Ms. and please no more. I have a monotheistic religion and English is 4th and foreign language to me. I have enough problems in life then extending English, I am here to learn and share technical knowledge nothing else. Anyone is welcome to change my answers and questions, but please don't force who you are over who I am, keep as it is or go neutral.
Updated on September 18, 2022Comments
-
user.dz over 1 year
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?
-
Admin over 8 yearsThere is really no such thing as “ANSI encoding”. Only a bad joke of some 1980s coders working in Microsoft.
-