Add basic unicode support to the console (linux workaround)
authorEsteban I. Ruiz Moreno <exio4.com@gmail.com>
Wed, 5 Jun 2013 01:14:31 +0000 (22:14 -0300)
committerPilzAdam <pilzadam@minetest.net>
Sat, 15 Jun 2013 15:09:11 +0000 (15:09 +0000)
src/guiChatConsole.cpp

index c1219fb808c29fe535e01b3267b5e7c4070f8444..daec18efc91901ec57b0585682effcc8bd8debf8 100644 (file)
@@ -550,7 +550,13 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
                }
                else if(event.KeyInput.Char != 0 && !event.KeyInput.Control)
                {
-                       m_chat_backend->getPrompt().input(event.KeyInput.Char);
+                       #if (defined(linux) || defined(__linux))
+                               wchar_t wc = L'_';
+                               mbtowc( &wc, (char *) &event.KeyInput.Char, sizeof(event.KeyInput.Char) );
+                               m_chat_backend->getPrompt().input(wc);
+                       #else
+                               m_chat_backend->getPrompt().input(event.KeyInput.Char);
+                       #endif
                        return true;
                }
        }