[MPlayer-dev-eng] utf-16 encoded subtitle files

Magnus Leuthner magnus.leuthner at googlemail.com
Thu Jul 16 20:27:09 CEST 2009


On Thu, Jul 16, 2009 at 6:37 PM, Evgeniy
Stepanov<eugeni.stepanov at gmail.com> wrote:
> On Thursday 16 July 2009 14:38:12 Ivan Kalvachev wrote:
>> On 7/12/09, Magnus Leuthner <magnus.leuthner at googlemail.com> wrote:
>> > On Sun, Jul 12, 2009 at 6:33 PM, Magnus
>> >
>> > Leuthner<magnus.leuthner at googlemail.com> wrote:
>> >> On Sun, Jul 12, 2009 at 12:32 PM, compn<tempn at twmi.rr.com> wrote:
>> >>> On Sat, 11 Jul 2009 19:59:51 +0100, Magnus Leuthner wrote:
>> >>>>+    // check or unsupported utf-16 encoding and inform the user
>> >>>>+    if( j == 1 &&
>> >>>>+        (line[0]) == (char)0xFF && (line[1]) == (char)0xFE ||
>> >>>>+        (line[0]) == (char)0xFE && (line[1]) == (char)0xFF
>> >>>>+    ) {
>> >>>>+        mp_msg(MSGT_SUBREADER,MSGL_ERR,"SUB: File seems to be UTF-16
>> >>>> encoded. This encoding is not supported.\n");
>> >>>>+        return SUB_INVALID;
>> >>>
>> >>> it might be worth it to try to continue anyways, in the event of a
>> >>> false positive? adding a simple command line that will convert the file
>> >>> for them too?
>> >>>
>> >>> also this error message could go in help/help_mp-en.h
>> >>> so it can be translated.
>> >>>
>> >>> -compn
>> >>> _______________________________________________
>> >>> MPlayer-dev-eng mailing list
>> >>> MPlayer-dev-eng at mplayerhq.hu
>> >>> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>> >>
>> >> Attached is the patch with the error message moved to
>> >> help/help_mp-en.h (and help_mp-de.h). I don't think the functionality
>> >> to convert character encodings belongs into the mplayer code, I just
>> >> wrote this patch to save other users the 30 minutes it took me to
>> >> realize the sub-file ENCODING was unsupported rather than the text
>> >> content itself.
>>
>> MPlayer uses iconv for character encoding conversion, you control it
>> via -subcp. I really doubt that such popular encoding is not supported
>> by it.
>>
>> Also, the enca library is used automatic detection of the subtitle
>> encodings. Do you have it build and configured properly?
>> ("subcp=enca:en:ascii"). I have got the impression that it is quite good
>> with guessing windows encodings.
>
> subreader applies iconv to subtitle lines after detecting format and parsing
> the whole file. This only works if file encoding is ascii-compatible.
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>

I tried it both with a bleeding-edge self-compiled version of mplayer
and with the version that is in the stable debian package tree, both
versions failed to tell the user about the unsupported UTF-16
encoding. I am not familiar with the inner workings of mplayer, but I
think this tiny patch can save a few people a bit of time and
frustration since the "unsupported format" subtitle file will look
fine in their UTF-16 enabled editor, which is puzzling at first.



More information about the MPlayer-dev-eng mailing list