[spice-gtk 3/3] win32: Convert locale dir from UTF-8 to local encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As indicated in gtk+ win32 gtk_get_localedir [1], bindtextdomain() is not
UTF-8 aware on win32, so it needs a filename in locale encoding

[1] https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/gtkwin32.c#L187
---
 src/spice-glib-main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/spice-glib-main.c b/src/spice-glib-main.c
index c2bd7ca6..881015fc 100644
--- a/src/spice-glib-main.c
+++ b/src/spice-glib-main.c
@@ -32,9 +32,13 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
     if (fdwReason == DLL_PROCESS_ATTACH) {
         char *basedir =
             g_win32_get_package_installation_directory_of_module(hinstDLL);
-        char *localedir = g_build_filename(basedir, "share", "locale", NULL);
+        char *utf8_localedir = g_build_filename(basedir, "share", "locale", NULL);
+        /* bindtextdomain's 2nd argument is not UTF-8 aware */
+        char *localedir = g_win32_locale_filename_from_utf8 (utf8_localedir);
+
         bindtextdomain(GETTEXT_PACKAGE, localedir);
         g_free(localedir);
+        g_free(utf8_localedir);
         g_free(basedir);
         bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
     }
-- 
2.17.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]