Recently I just upgraded my Ubuntu Desktop from 11.04 to 12.04 LTS. And of course a lot new problems came to me.
And one of the problem is the SRT file.
Actually, this is not a new problem to me, but I was always choosing the workaround way.
This time, no more workaround. I'll present you the correct way.
Until now I still don't have a clue for the root cause of this problem yet, but in chunghe's blog I found this is really nice and easy way to solve the problem.
Problem Description
The original contain of the SRT is like this.
I still can see the numbers, which means the file is somewhat correct, but the Chinese word didn't display correctly.
In gEdit, I tried to open it with UTF-8 encoding
There are errors
Solutions
For chunghe's blogpost, he introduced an utility called enca.
Usage1 show file information : enca <filename>
This will display the information of the file content. For my file here it shows
It's Big5(Is this the reason I cannot see the font correctly?) , with CRLF line terminators.
Usage 2 convert file to desired format : enca –x <encoding>
I wrote an scritp to do this. The content is :
enca -x UTF-8 < $1.srt > $1.utf8.srt
The content of the converted file.
Conclusion
This way is much easier and more straight and forward.
Before this, I have to copy the file to Windows environment and open notepad++ to convert it to UTF-8.
Now everything can be done under Ubuntu.