oaprograms / lingo-player

Open source video player with language learning features
MIT License
129 stars 24 forks source link

Auto-detect subtitle encoding #2

Open jaruba opened 9 years ago

jaruba commented 9 years ago

Best module I know for this is: https://www.npmjs.com/package/jschardet

It should be noted that subtitle encoding is never 100%, no matter how good the module is, the issue comes from extremely similar encodings that can be mistaken for one another.

oaprograms commented 9 years ago

Actually I am using jschardet, but only to detect if the encoding is utf-8. If it's not utf-8, I'm using some kind of language-encoding mapping, since the language of the subtitle is known. I'm not sure if this approach is more precise than jschardet though. But the user can change encoding manually as well, so it shouldn't be a big deal.