I'm having a problem with encoding of ISO-8859-1 text file (subtitles in Polish language), which looks something like that:

Mieszka³ sam,|¿adnej ¿ony, dzieci.

It should be : "Mieszkał sam, żadnej żony, dzieci".

I've tried:

  • converting the text file to UTF-8 using iconv
  • changing encoding to UTF-8 using medit.
  • changing system language to Polish (I'm using English locale on system language, but Polish keyboard settings)

I'm using Arch Linux distro. I'll put the information about locales, as maybe it can have an effect on the case.


Thank you for all your answers.

2 Answers 2


The standard 8-bit encoding for Polish is latin2 a.k.a. ISO 8859-2. The text with ³ for ł, ¿ for ż etc. is the result of interpreting a sequence of bytes that represent text in latin2 as if they represented latin1. Latin1 a.k.a. ISO 8859-1 is the standard encoding for most West European languages.

If the text is encoded in latin2, then you need to convert it from latin2 to UTF-8, instead of from latin1 to UTF-8.

iconv -f latin2 -t utf8

(The -t utf8 is optional here since you're calling UTF-8 locale.)

If what you're showing is the text as you read it, then it means it was badly converted from 8-bit to Unicode at some point. To correct it, convert back to the original bytes then convert those to your encoding.

iconv -f utf8 -t latin1 | iconv -f latin2 -t utf8
  • I've followed your instructions, but unfortunately that did not solved the problem. While using command iconv -f utf8 -t latin1 test.txt the terminal showed error: iconv: illegal input sequence at position 136 which is position of letter "ł" in subtitles text. The funny thing is, that medit/gedit show the ISO-8859-1 encoding, while file command shows something like that: file -i test.txt test.txt: text/plain; charset=unknown-8bit Commented Jul 20, 2016 at 10:31
  • @mordowiciel What about the first command? The encoding of a file is not stored, so editors guess and they might guess wrong. Post the output of od -t x1c test.txt, at least the part including some of these characters and the hexadecimal line above. Commented Jul 20, 2016 at 12:32

I found the solution and I'll leave the answer here, as it might be useful for other people who have the same problem.

Open the text file using different encoding! For me (Polish language), it was CP1250 (Central European). To do this, open gedit, select "Open" option and find the neeeded file. Then choose the character encoding (bottom left side) and pick "WINDOWS-1250".

As it was connected with the movie subtitles, it isn't necessary to manually change encoding every time before running subtitles with a movie. In almost every video player there is an option to choose default subtitles encoding. For Polish, just choose Windows-1250, and the application would read the subtitles as if they were encoded in that coding.

Anyway, thank you for your help Gilles!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .