[vlc-commits] Win32: fix gettext with non-ASCII installation path

Rémi Denis-Courmont git at videolan.org
Mon Jan 24 17:33:40 CET 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 24 18:32:10 2011 +0200| [7b21f9d5490bd37f64b3aa67fce05e1a7d9b811f] | committer: Rémi Denis-Courmont

Win32: fix gettext with non-ASCII installation path

Note that this only works if the path can be represented in the ANSI
code page. Otherwise, you will need to patch gettext.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7b21f9d5490bd37f64b3aa67fce05e1a7d9b811f
---

 src/modules/textdomain.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/modules/textdomain.c b/src/modules/textdomain.c
index 4d7e54e..96a0072 100644
--- a/src/modules/textdomain.c
+++ b/src/modules/textdomain.c
@@ -29,6 +29,7 @@
 # include <libintl.h>
 # if defined (__APPLE__) || defined (WIN32)
 #  include "config/configuration.h"
+#  include <vlc_charset.h>
 # endif
 #endif
 
@@ -41,13 +42,15 @@ int vlc_bindtextdomain (const char *domain)
 # if !defined (__APPLE__) && !defined (WIN32)
     static const char path[] = LOCALEDIR;
 # else
-    char *datadir = config_GetDataDirDefault();
-    char *path;
+    char *path = config_GetDataDirDefault();
+    char *buf;
 
-    if (unlikely(datadir == NULL))
+    if (unlikely(path == NULL))
         return -1;
-    ret = asprintf (&path, "%s" DIR_SEP "locale", datadir);
-    free (datadir);
+    ret = asprintf (&buf, "%s" DIR_SEP "locale", path);
+    free (path);
+    path = ToLocaleDup (buf);
+    free (buf);
 # endif
 
     if (bindtextdomain (domain, path) == NULL)



More information about the vlc-commits mailing list