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

[virt-tools-list] [PATCH virt-viewer] fix character encoding on Windows platform



virt-viewer can't handle encoding of its command line arguments correctly on Windows. As a simple test case, simply run

    remote-viewer -t "你好" spice://<target-host>:5900 

on Windows and the titlebar will not display characters as we expect.

From 5e52e3a2a292e9a663fc9ba6560603df5aca66b7 Mon Sep 17 00:00:00 2001
From: root <root localhost localdomain>
Date: Mon, 15 Oct 2018 10:30:01 +0800
Subject: [PATCH] win32: fix command line encoding on windows platform

---
 configure.ac          | 4 ++--
 src/virt-viewer-app.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index d5eb258..08fc75e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,8 +13,8 @@ m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
 AM_SILENT_RULES([yes])
 
 # Keep these two definitions in agreement.
-GLIB2_REQUIRED="2.38"
-GLIB2_ENCODED_VERSION="GLIB_VERSION_2_38"
+GLIB2_REQUIRED="2.40"
+GLIB2_ENCODED_VERSION="GLIB_VERSION_2_40"
 
 # Keep these two definitions in agreement.
 GTK_REQUIRED="3.12"
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 2a88882..08fb234 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1882,7 +1882,11 @@ virt_viewer_app_local_command_line (GApplication   *gapp,
     g_option_context_add_group(context, spice_get_option_group());
 #endif
 
+#ifndef G_OS_WIN32
     if (!g_option_context_parse(context, &argc, args, &error)) {
+#else
+    if (!g_option_context_parse_strv(context, args, &error)) {
+#endif
         if (error != NULL) {
             g_printerr(_("%s\n"), error->message);
             g_error_free(error);
-- 
2.17.2

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