[pve-devel] [PATCH spiceterm 2/2] add utf8 parameter to spiceterm

Dominik Csapak d.csapak at proxmox.com
Tue Feb 28 12:06:42 CET 2017


this adds a parameter "utf8" to force the utf8 mode of the terminal

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 spiceterm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/spiceterm.c b/spiceterm.c
index bcb38c6..3eebf18 100644
--- a/spiceterm.c
+++ b/spiceterm.c
@@ -1627,6 +1627,7 @@ main (int argc, char** argv)
     int pid;
     int master;
     char ptyname[1024];
+    uint8_t utf8 = 0;
     struct winsize dimensions;
     SpiceTermOptions opts = {
         .timeout = 10,
@@ -1645,6 +1646,7 @@ main (int argc, char** argv)
         { "keymap", required_argument, 0, 'k' },
         { "noauth", no_argument, 0, 'n' },
         { "sasl", no_argument, 0, 's' },
+	{ "utf8", no_argument, 0, 'u'},
         { NULL, 0, 0, 0 },
     };
 
@@ -1675,6 +1677,9 @@ main (int argc, char** argv)
         case 't':
             opts.timeout = atoi(optarg);
             break;
+	case 'u':
+	    utf8 = 1;
+	    break;
         case '?':
             spiceterm_print_usage(NULL);
             exit(-1);
@@ -1699,7 +1704,7 @@ main (int argc, char** argv)
     char *ctype = setlocale (LC_CTYPE, NULL); // query LC_CTYPE
 
     // fixme: ist there a standard way to detect utf8 mode ?
-    if (strcasestr (ctype, ".utf-8")||strcasestr (ctype, ".utf8")) {
+    if (strcasestr (ctype, ".utf-8")||strcasestr (ctype, ".utf8") || utf8) {
         vt->utf8 = 1;
     }
 
-- 
2.1.4





More information about the pve-devel mailing list