[Top][All Lists]

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

[Xlog-discussion] netkeyer.c character set fix

From: Jon Kåre Hellan
Subject: [Xlog-discussion] netkeyer.c character set fix
Date: Wed, 26 Nov 2008 20:39:47 +0100
User-agent: Thunderbird (X11/20080925)


cwdaemon can send some latin-1 characters outside ascii, but expects to see latin-1. GTK applications these days, including xlog, use utf-8 internally. Making unixcw unicode aware sounds rather pointless, so I made the fix below to netkeyer.c. I had to convert to upper case before converting to latin-1 because cwdaemon fails to convert when character is non-ascii.


--- xlog-1.7.orig/src/netkeyer.c
+++ xlog-1.7/src/netkeyer.c
@@ -77,6 +77,13 @@
        gchar buf[80];
        ssize_t sendto_rc;
+       gsize length = 0;
+       gchar *upcasestr;
+       upcasestr = g_utf8_strup (cwmessage, -1);
+       cwmessage = g_convert(upcasestr, -1,
+                             "ISO-8859-1", "UTF-8", NULL, &length, NULL);
+       g_free (upcasestr);

        switch (cw_op)
@@ -102,5 +109,6 @@
                sendto_rc = -1;

+       g_free (cwmessage);
        return sendto_rc;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]