foxygit / doom Log in
commit 410c695fa1b7994934545cccc7cc6afc28e9db3b
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sat Jan 21 02:12:44 2017 +0000
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Sat Jan 21 02:12:44 2017 +0000

    setup: Print key names as UTF8.

    Key names can contain arbitrary Unicode characters and these should
    be printed to the screen using TXT_DrawUTF8String(). Noted as part
    of #840 where random garbled characters were being shown for key
    labels as a result of UTF8->Extended ASCII mojibake.
---
 src/setup/txt_keyinput.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/setup/txt_keyinput.c b/src/setup/txt_keyinput.c
index bf76f07b..c2d54552 100644
--- a/src/setup/txt_keyinput.c
+++ b/src/setup/txt_keyinput.c
@@ -22,6 +22,7 @@
 #include "txt_gui.h"
 #include "txt_io.h"
 #include "txt_label.h"
+#include "txt_utf8.h"
 #include "txt_window.h"

 #define KEY_INPUT_WIDTH 8
@@ -113,10 +114,10 @@ static void TXT_KeyInputDrawer(TXT_UNCAST_ARG(key_input))

     TXT_SetWidgetBG(key_input);
     TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
-
-    TXT_DrawString(buf);
-
-    for (i=strlen(buf); i<KEY_INPUT_WIDTH; ++i)
+
+    TXT_DrawUTF8String(buf);
+
+    for (i = TXT_UTF8_Strlen(buf); i < KEY_INPUT_WIDTH; ++i)
     {
         TXT_DrawString(" ");
     }