-#if (defined OS2 || !HAVE_LANGINFO_CODESET) && !defined WIN32
-static const char* vlc_encoding_from_language( const char *l )
-{
- /* check for language (and perhaps country) codes */
- if (strstr(l, "zh_TW")) return "Big5";
- if (strstr(l, "zh_HK")) return "Big5HKSCS"; /* no MIME charset */
- if (strstr(l, "zh")) return "GB2312";
- if (strstr(l, "th")) return "TIS-620";
- if (strstr(l, "ja")) return "EUC-JP";
- if (strstr(l, "ko")) return "EUC-KR";
- if (strstr(l, "ru")) return "KOI8-R";
- if (strstr(l, "uk")) return "KOI8-U";
- if (strstr(l, "pl") || strstr(l, "hr") ||
- strstr(l, "hu") || strstr(l, "cs") ||
- strstr(l, "sk") || strstr(l, "sl")) return "ISO-8859-2";
- if (strstr(l, "eo") || strstr(l, "mt")) return "ISO-8859-3";
- if (strstr(l, "lt") || strstr(l, "la")) return "ISO-8859-4";
- if (strstr(l, "bg") || strstr(l, "be") ||
- strstr(l, "mk") || strstr(l, "uk")) return "ISO-8859-5";
- if (strstr(l, "ar")) return "ISO-8859-6";
- if (strstr(l, "el")) return "ISO-8859-7";
- if (strstr(l, "he") || strstr(l, "iw")) return "ISO-8859-8";
- if (strstr(l, "tr")) return "ISO-8859-9";
- if (strstr(l, "th")) return "ISO-8859-11";
- if (strstr(l, "lv")) return "ISO-8859-13";
- if (strstr(l, "cy")) return "ISO-8859-14";
- if (strstr(l, "et")) return "ISO-8859-15"; /* all latin1 could be iso15 as well */
- if (strstr(l, "ro")) return "ISO-8859-2"; /* or ISO-8859-16 */
- if (strstr(l, "am") || strstr(l, "vi")) return "UTF-8";
- /* We don't know. This ain't working go to default. */
- return "ISO-8859-1";
-}
-#endif
-
-static const char* vlc_charset_aliases( const char *psz_name )
-{
- VLCCharsetAlias *a;
-
-#if defined WIN32
- VLCCharsetAlias aliases[] =
- {
- { "CP936", "GBK" },
- { "CP1361", "JOHAB" },
- { "CP20127", "ASCII" },
- { "CP20866", "KOI8-R" },
- { "CP21866", "KOI8-RU" },
- { "CP28591", "ISO-8859-1" },
- { "CP28592", "ISO-8859-2" },
- { "CP28593", "ISO-8859-3" },
- { "CP28594", "ISO-8859-4" },
- { "CP28595", "ISO-8859-5" },
- { "CP28596", "ISO-8859-6" },
- { "CP28597", "ISO-8859-7" },
- { "CP28598", "ISO-8859-8" },
- { "CP28599", "ISO-8859-9" },
- { "CP28605", "ISO-8859-15" },
- { NULL, NULL }
- };
-#elif defined (SYS_AIX)
- VLCCharsetAlias aliases[] =
- {
- { "IBM-850", "CP850" },
- { "IBM-856", "CP856" },
- { "IBM-921", "ISO-8859-13" },
- { "IBM-922", "CP922" },
- { "IBM-932", "CP932" },
- { "IBM-943", "CP943" },
- { "IBM-1046", "CP1046" },
- { "IBM-1124", "CP1124" },
- { "IBM-1129", "CP1129" },
- { "IBM-1252", "CP1252" },
- { "IBM-EUCCN", "GB2312" },
- { "IBM-EUCJP", "EUC-JP" },
- { "IBM-EUCKR", "EUC-KR" },
- { "IBM-EUCTW", "EUC-TW" },
- { NULL, NULL }
- };
-#elif defined (SYS_HPUX)
- VLCCharsetAlias aliases[] =
- {
- { "ROMAN8", "HP-ROMAN8" },
- { "ARABIC8", "HP-ARABIC8" },
- { "GREEK8", "HP-GREEK8" },
- { "HEBREW8", "HP-HEBREW8" },
- { "TURKISH8", "HP-TURKISH8" },
- { "KANA8", "HP-KANA8" },
- { "HP15CN", "GB2312" },
- { NULL, NULL }
- };
-#elif defined (SYS_IRIX)
- VLCCharsetAlias aliases[] =
- {
- { "EUCCN", "GB2312" },
- { NULL, NULL }
- };
-#elif defined (SYS_OSF)
- VLCCharsetAlias aliases[] =
- {
- { "KSC5601", "CP949" },
- { "SDECKANJI", "EUC-JP" },
- { "TACTIS", "TIS-620" },
- { NULL, NULL }
- };
-#elif defined (SYS_SOLARIS)
- VLCCharsetAlias aliases[] =
- {
- { "646", "ASCII" },
- { "CNS11643", "EUC-TW" },
- { "5601", "EUC-KR" },
- { "JOHAP92", "JOHAB" },
- { "PCK", "SHIFT_JIS" },
- { "2533", "TIS-620" },
- { NULL, NULL }
- };
-#elif defined (SYS_BSD)
- VLCCharsetAlias aliases[] =
- {
- { "646", " ASCII" },
- { "EUCCN", "GB2312" },
- { NULL, NULL }
- };
-#else
- VLCCharsetAlias aliases[] = {{NULL, NULL}};
-#endif
-
- for (a = aliases; a->psz_alias; a++)
- if (strcasecmp (a->psz_alias, psz_name) == 0)
- return a->psz_name;
-
- /* we return original name beacuse iconv() probably will know
- * something better about name if we don't know it :-) */
- return psz_name;
-}
-
-/* Returns charset from "language_COUNTRY.charset@modifier" string */
-#if (defined OS2 || !HAVE_LANGINFO_CODESET) && !defined WIN32
-static void vlc_encoding_from_locale( char *psz_locale, char *psz_charset )