Ubuntu – .srt text files that are in greek are not displayed properly

file-rollergeditunzip

I'm running ubuntu 16.04 and when I download subtitles for movies, extract the zip file end then attempt to open the .srt file with gedit I see just gibberish of this form:

1 00:04:17,052 --> 00:04:18,963 ÊáëÞ ãç.
2 00:04:19,452 --> 00:04:20,851 ¹ôáí êÜðïôå.

I tried opening the file with jedit and LibreOffice Writer but that doesn't work either. On gedit, instead of just double clicking the file in order to open it, I tried to open gedit first and then browse to my file having set the character encoding to greek and the text language to greek also but that didn't seem to help.

I also followed the instructions I found in another question on a similar matter but that made no difference at all.
I really don't know where the problem is, in gedit or file roller. Even more strangely, when I was running 14.04 I remember following the procedure I described in the beginning and everything worked perfectly.

I'm relatively new to Linux and I can perform only basic things using the terminal. I would appreciate it if someone could help me out.

Best Answer

I had the same issue and just solved it through others's help. Opening it directly with gedit, LibreOffice or other editors and trying to save it in another encoding didn't help. The reason is they are usually encoded in Windows-1253 set, while many Linux programs automatically detect this codeset as "Western".

One easy way to go about it, is to tell every program you use that it's not a "Western" codeset. For Gedit, you can do that by opening gedit alone, go to "Open file", chose your file and at the bottom of the window the correct "Character Encoding", which should write "Automatically detected" at this point and must be changed to a Greek codeset for getting a readable text. Gedit then opens the file in the correct codeset. For VLC, since we are discussing about subtitles, the only thing to do is change the default subtitle encoding to "Windows-1253", you can find it in "Preferences"/"Subtitles". Greek letters appear normally then, even if you can't read the .srt properly in another editor.

The other, and safest, way to open readable greek characters in txt files that were written in windows machines is to first convert them to UTF-8, which will give you a permanent solution for the specific file. The way to do that is through console with iconv tool :

iconv -f Windows-1253 -t UTF-8 input.txt > output.txt

Obviously, you either execute it from the folder the .txt file is located, or from anywhere else, but giving the whole path for input.txt and output.txt in that case. In rare cases, the original file encoding could be ISO-8859-7, which is another greek encoding, if Windows-1253 doesn't work you could try that too, replacing it as "from" encoding, i.e.

iconv -f ISO-8859-7 -t UTF-8 input.txt > output.txt
Related Question