diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 7c9d434d0e..5a9aa5fc12 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -2033,10 +2033,15 @@ ``--subcp=`` If your system supports ``iconv(3)``, you can use this option to specify - the subtitle codepage. + the subtitle codepage. By default, ENCA will be used to guess the charset. + If mpv is not compiled with ENCA, ``UTF-8:UTF-8-BROKEN`` is the default, + which means it will try to use UTF-8, otherwise the ``UTF-8-BROKEN`` + pseudo codepage (see below). Warning: if you force the charset, even subtitles that are known to be - UTF-8 will be recoded, which is perhaps not what you expect. + UTF-8 will be recoded, which is perhaps not what you expect. Prefix + codepages with ``utf8:`` if you want the codepage to be used only if the + input is not valid UTF-8. .. admonition:: Examples @@ -2044,17 +2049,21 @@ - ``--subcp=utf8:cp1250`` Use CP1250 if input is not UTF-8. - ``--subcp=cp1250`` Always force recoding to cp1250. + The pseudo codepage ``UTF-8-BROKEN`` is used internally. If this is used + as codepage, the subtitle will be interpreted as UTF-8, but with "Latin 1" + as fallback for bytes which are not valid UTF-8 sequences. This codepage + name is never passed to iconv. + If the player was compiled with ENCA support, you can use special syntax to use that:: - --subcp=enca:: + ``--subcp=enca::`` You can specify your language using a two letter language code to make ENCA detect the codepage automatically. If unsure, enter anything (if the language is invalid, mpv will complain and list valid languages). Fallback codepage specifies the codepage to use if autodetection fails. - If no fallback is specified, the subtitle will be interpreted as UTF-8, - but with "Latin 1" as fallback for bytes that are not valid UTF-8 sequences. + If no fallback is specified, ``UTF-8-BROKEN`` is used. .. admonition:: Examples diff --git a/mpvcore/options.c b/mpvcore/options.c index df75a038ac..e0d138a545 100644 --- a/mpvcore/options.c +++ b/mpvcore/options.c @@ -810,6 +810,11 @@ const struct MPOpts mp_default_opts = { .ass_style_override = 1, .use_embedded_fonts = 1, .suboverlap_enabled = 0, +#ifdef CONFIG_ENCA + .sub_cp = "enca", +#else + .sub_cp = "UTF-8:UTF-8-BROKEN", +#endif .hwdec_codecs = "all",