]> git.sesse.net Git - vlc/commitdiff
* src/libvlc.c: use UTF-8 internally on win32.
authorGildas Bazin <gbazin@videolan.org>
Sat, 19 Jul 2003 14:22:08 +0000 (14:22 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sat, 19 Jul 2003 14:22:08 +0000 (14:22 +0000)
src/libvlc.c

index b7feb1ef55e703a82dc919f1fbc34b84fbb40f07..f56f840716513328ed1459c2655ebd28c17b3ada 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.c: main libvlc source
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.c,v 1.92 2003/07/01 12:56:47 sam Exp $
+ * $Id: libvlc.c,v 1.93 2003/07/19 14:22:08 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -350,7 +350,8 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
 
         textdomain( PACKAGE );
 
-#if defined( SYS_BEOS ) || defined ( SYS_DARWIN )
+#if defined( SYS_BEOS ) || defined ( SYS_DARWIN ) || \
+    ( defined( WIN32 ) && !defined( HAVE_INCLUDED_GETTEXT ) )
         /* BeOS only support UTF8 strings */
         /* Mac OS X prefers UTF8 */
         bind_textdomain_codeset( PACKAGE, "UTF-8" );
@@ -1014,20 +1015,6 @@ static void SetLanguage ( char const *psz_lang )
     char            psz_tmp[1024];
 #endif
 
-#   if defined( HAVE_INCLUDED_GETTEXT ) && !defined( HAVE_LC_MESSAGES )
-    if( *psz_lang )
-    {
-        /* We set LC_ALL manually because it is the only way to set
-         * the language at runtime under eg. Windows. Beware that this
-         * makes the environment unconsistent when libvlc is unloaded and
-         * should probably be moved to a safer place like vlc.c. */
-        static char psz_lcall[20];
-        snprintf( psz_lcall, 19, "LC_ALL=%s", psz_lang );
-        psz_lcall[19] = '\0';
-        putenv( psz_lcall );
-    }
-#   endif
-
     if( psz_lang && !*psz_lang )
     {
 #   if defined( HAVE_LC_MESSAGES )
@@ -1035,23 +1022,25 @@ static void SetLanguage ( char const *psz_lang )
 #   endif
         setlocale( LC_CTYPE, psz_lang );
     }
-    else
+    else if( psz_lang )
     {
-#ifdef SYS_BEOS 
-        static char psz_lcall[20];
-#endif
-        setlocale( LC_ALL, psz_lang );
 #ifdef SYS_DARWIN
         /* I need that under Darwin, please check it doesn't disturb
          * other platforms. --Meuuh */
         setenv( "LANG", psz_lang, 1 );
-#endif
-#ifdef SYS_BEOS
-        /* I need this under BeOS... */
+
+#elif defined( SYS_BEOS ) || defined( WIN32 )
+        /* We set LC_ALL manually because it is the only way to set
+         * the language at runtime under eg. Windows. Beware that this
+         * makes the environment unconsistent when libvlc is unloaded and
+         * should probably be moved to a safer place like vlc.c. */
+        static char psz_lcall[20];
         snprintf( psz_lcall, 19, "LC_ALL=%s", psz_lang );
         psz_lcall[19] = '\0';
         putenv( psz_lcall );
 #endif
+
+        setlocale( LC_ALL, psz_lang );
     }
 
     /* Specify where to find the locales for current domain */
@@ -1071,7 +1060,8 @@ static void SetLanguage ( char const *psz_lang )
     /* Set the default domain */
     textdomain( PACKAGE );
 
-#if defined( SYS_BEOS ) || defined ( SYS_DARWIN )
+#if defined( SYS_BEOS ) || defined ( SYS_DARWIN ) || \
+    ( defined( WIN32 ) && !defined( HAVE_INCLUDED_GETTEXT ) )
     /* BeOS only support UTF8 strings */
     /* Mac OS X prefers UTF8 */
     bind_textdomain_codeset( PACKAGE, "UTF-8" );