Index: gok/gok-scanner.c
===================================================================
--- gok/gok-scanner.c	(revision 2598)
+++ gok/gok-scanner.c	(working copy)
@@ -26,6 +26,7 @@
 #include <dirent.h>
 #include <locale.h>
 #include <gconf/gconf-client.h>
+
 #include "gok-scanner.h"
 #include "gok-data.h"
 #include "gok-log.h"
@@ -36,6 +37,7 @@
 #include "gok-gconf.h" 
 #include "main.h"
 #include "gok-repeat.h"
+#include "gok-util.h"
 
 #define REPEAT_OFF_NAME "repeat"
 
@@ -1752,8 +1754,8 @@ gboolean gok_scanner_change_method (gcha
 	g_assert (m_pAccessMethodFirst != NULL);
 
 	/* Are we already using this access method? */
-	if ((m_pAccessMethodCurrent != NULL) &&
-		(strcmp (NameAccessMethod, m_pAccessMethodCurrent->Name) == 0))
+	if (m_pAccessMethodCurrent &&
+	    gok_util_utf8_casecmp (NameAccessMethod, m_pAccessMethodCurrent->Name) == 0)
 	{
 		/* yes, so nothing to do */
 		return TRUE;
@@ -1766,7 +1768,7 @@ gboolean gok_scanner_change_method (gcha
 	pAccessMethod = m_pAccessMethodFirst;
 	while (pAccessMethod != NULL)
 	{
-		if (g_strcasecmp (pAccessMethod->Name, NameAccessMethod) == 0)
+		if (gok_util_utf8_casecmp (pAccessMethod->Name, NameAccessMethod) == 0)
 		{
 			/* found the access method */
 			m_pAccessMethodCurrent = pAccessMethod;
Index: gok/gok-util.c
===================================================================
--- gok/gok-util.c	(revision 0)
+++ gok/gok-util.c	(revision 0)
@@ -0,0 +1,65 @@
+/* 
+ * gok-util.c
+ *
+ * Copyright 2008 University Of Toronto
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gok-util.h"
+
+/**
+ * gok_util_utf8_strcmp:
+ * @a: a UTF-8 encoded string
+ * @b: a UTF-8 encoded string
+ *
+ * Compares two strings for ordering using the linguistically correct
+ * rules for the current locale.
+ *
+ * Returns: Same as strcmp().
+ **/
+gint
+gok_util_utf8_strcmp (const gchar *a, const gchar *b)
+{
+    return g_utf8_collate (a, b);
+}
+
+/**
+ * gok_util_utf8_casecmp:
+ * @a: a UTF-8 encoded string
+ * @b: a UTF-8 encoded string
+ *
+ * Compares two strings for ordering using the linguistically correct
+ * rules for the current locale. Case-insensitve version.
+ *
+ * Returns: Same as strcmp().
+ **/
+gint
+gok_util_utf8_casecmp (const gchar *a, const gchar *b)
+{
+    gchar *a_fold, *b_fold;
+    gint res;
+
+    a_fold = g_utf8_casefold (a, -1);
+    b_fold = g_utf8_casefold (b, -1);
+
+    res = g_utf8_collate (a_fold, b_fold);
+
+    g_free (a_fold);
+    g_free (b_fold);
+
+    return res;
+}
Index: gok/gok-util.h
===================================================================
--- gok/gok-util.h	(revision 0)
+++ gok/gok-util.h	(revision 0)
@@ -0,0 +1,36 @@
+/* 
+ * gok-util.h
+ *
+ * Copyright 2008 University Of Toronto
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GOK_UTIL__
+#define __GOK_UTIL__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gint gok_util_utf8_strcmp  (const gchar *a,
+			    const gchar *b);
+gint gok_util_utf8_casecmp (const gchar *a,
+			    const gchar *b);
+
+G_END_DECLS
+
+#endif /* __GOK_UTIL__ */
Index: gok/main.c
===================================================================
--- gok/main.c	(revision 2598)
+++ gok/main.c	(working copy)
@@ -48,6 +48,7 @@
 #ifdef HAVE_XEVIE
 #include <X11/extensions/Xevie.h>
 #endif
+
 #include "main.h"
 #include "gok.h"
 #include "gok-word-complete.h"
@@ -69,6 +70,7 @@
 #include "gok-bounds.h"
 #include "gok-keyslotter.h"
 #include "gok-gconf.h"
+#include "gok-util.h"
 
 #ifdef ENABLE_LIBUSB_INPUT
 #include "gok-libusb.h"
@@ -557,17 +559,17 @@ gint main (gint argc, gchar *argv[])
 gint
 comparebasenames (gconstpointer a, gconstpointer b)
 {
-	gchar* a_file;
-	gchar* b_file;
+	gchar *a_file, *b_file;
 	gint returncode;
-	a_file = g_path_get_basename(a);
-	b_file = g_path_get_basename(b);
 
-	returncode = g_strcasecmp(a_file, b_file);
-	
+	a_file = g_path_get_basename (a);
+	b_file = g_path_get_basename (b);
+
+	returncode = gok_util_utf8_casecmp (a_file, b_file);
+
 	g_free (a_file);
 	g_free (b_file);
-	
+
 	return returncode;
 }
 
@@ -1677,7 +1679,7 @@ GokKeyboard *
 gok_main_keyboard_find_byname (const gchar *NameKeyboard)
 {
 	GokKeyboard *pKB = NULL;
-	
+
 	if (NameKeyboard == NULL)
 	{
 		/* if keyboard name is NULL then use first keyboard in list */
@@ -1689,7 +1691,7 @@ gok_main_keyboard_find_byname (const gch
 		pKB = m_pKeyboardFirst;
 		while (pKB != NULL)
 		{
-			if (g_strcasecmp (pKB->Name, NameKeyboard) == 0)
+			if (gok_util_utf8_casecmp (pKB->Name, NameKeyboard) == 0)
 			{
 				/* found the keyboard */
 				break;
Index: gok/Makefile.am
===================================================================
--- gok/Makefile.am	(revision 2598)
+++ gok/Makefile.am	(working copy)
@@ -39,6 +39,7 @@ gok_SOURCES = \
 	gok-button.c gok-button.h                        \
 	gok-chunker.c gok-chunker.h                      \
 	gok-data.c gok-data.h                            \
+	gok-util.c gok-util.h				 \
 	gok-repeat.c gok-repeat.h                        \
 	gok-mousecontrol.c gok-mousecontrol.h            \
 	gok-keyboard.c gok-keyboard.h                    \
Index: gok/create-branching-keyboard.c
===================================================================
--- gok/create-branching-keyboard.c	(revision 2598)
+++ gok/create-branching-keyboard.c	(working copy)
@@ -37,12 +37,12 @@ read_branch_count (GIOChannel *infile)
 {
     gchar *line;
     guint len;
-    GError *error = NULL;
     gint count = 0;
     GIOStatus status;
+
     do
     {
-	status = g_io_channel_read_line (infile, &line, &len, NULL, &error);
+	status = g_io_channel_read_line (infile, &line, &len, NULL, NULL);
 	if (status != G_IO_STATUS_NORMAL || len < 2 || 
 	    g_str_has_prefix (line, "#")) 
 	{
@@ -90,9 +90,11 @@ kbd_file_close (KbdFile *kbd)
 {
     gchar *buf;
     gsize bytz;
+
     buf = g_strconcat ("</GOK:keyboard>\n</GOK:GokFile>\n", NULL);
     g_io_channel_write_chars (kbd->io, buf, -1, &bytz, NULL);
-    g_io_channel_close (kbd->io);
+    g_io_channel_unref (kbd->io);
+    g_free (buf);
 }
 
 static void
@@ -198,9 +200,9 @@ create_kbd_from_file (GIOChannel *infile
 
 int main (int argc, gchar **argv)
 {
-    GError *error;
     GIOChannel *infile;
     gint rows = 4;
+
     if (argc > 2)
     {
 	rows = atoi (argv[2]);
@@ -218,6 +220,7 @@ int main (int argc, gchar **argv)
 	g_message ("using %d columns", cols);
 	g_io_channel_seek_position (infile, 0, G_SEEK_SET, NULL);
 	create_kbd_from_file (infile, argv[1], cols);
+	g_io_channel_unref (infile);
     }
     else
 	g_error ("can't open file %s for reading", argv[1]);
