]> git.sesse.net Git - vlc/blobdiff - src/text/wincp.c
Added CD+G file support:
[vlc] / src / text / wincp.c
index d0447e19a22dd1c2ba60611ee3ba6d0023e70e6a..318b5e6a7edfada46f294a232a3c2f361a9f576b 100644 (file)
@@ -23,9 +23,6 @@
 /*** We need your help to complete this file!! Look for FIXME ***/
 
 #include <vlc/vlc.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 
 #ifndef WIN32
 # include <locale.h>
@@ -58,7 +55,7 @@ static const char *FindFallbackEncoding (const char *locale)
 {
     if ((locale == NULL) || (strlen (locale) < 2)
      || !strcasecmp (locale, "POSIX"))
-        return "ASCII";
+        return "CP1252"; /* Yeah, this is totally western-biased */
 
 
     /*** The ISO-8859 series (anything but Asia) ***/
@@ -194,26 +191,19 @@ static const char *FindFallbackEncoding (const char *locale)
 const char *GetFallbackEncoding( void )
 {
 #ifndef WIN32
-    const char *psz_lang = NULL;
-
-    /* Some systems (like Darwin, SunOS 4 or DJGPP) have only the C locale.
-     * Therefore we don't use setlocale here; it would return "C". */
-#  if defined (HAVE_SETLOCALE) && !defined ( __APPLE__)
-    psz_lang = setlocale (LC_ALL, NULL);
-#  endif
-    if (psz_lang == NULL)
+    const char *psz_lang;
+
+    psz_lang = getenv ("LC_ALL");
+    if ((psz_lang == NULL) || !*psz_lang)
     {
-        psz_lang = getenv ("LC_ALL");
+        psz_lang = getenv ("LC_CTYPE");
         if ((psz_lang == NULL) || !*psz_lang)
-        {
-            psz_lang = getenv ("LC_CTYPE");
-            if ((psz_lang == NULL))
-                psz_lang = getenv ("LANG");
-        }
+            psz_lang = getenv ("LANG");
     }
 
     return FindFallbackEncoding (psz_lang);
 #else
+    static char buf[16] = "";
     if (buf[0] == 0)
         snprintf (buf, sizeof (buf), "CP%u", GetACP ());
     return buf;