Check for invalid characters in subtitle files
inspired by #2245 (closed) and having checked that iconv already emits error messages I propose the following two changes for subtitle encodings:
- If there are invalid characters (invalid according to the used/specified encoding) in the subtitle file, a warning is emitted informing them about this and that this indicates that the currently used encoding is likely invalid (plus some hint on how to choose the right one). Given that text subtitles are usually small one could even check for this at the beginning of the muxing process and abort right at the start if there are invalid characters. This of course is no option if the subs are interleaved in a "big" file. (For the sake of batch users there should be an option to always treat this as non-terminating error.)
- A lot of (most?) users probably only ever encounter two types of encodings: Unicode UTF-8 and a legacy codepage (which one depends upon the language and location of the particular user). Text in said codepages is usually invalid UTF-8 (and probably also invalid according to other unicode encodings). So maybe one could automate the selection of encodings even further by letting the user select primary and secondary encodings: If a subtitle file contains invalid characters when treated as being encoded in the first encoding, then we test the second encoding and if the subtitle file is valid according to this encoding, MKVToolNix uses this. The application I have in mind is that the primary encoding is UTF-8 and the second encoding is the locally used codepage, but that is up to the user.