summaryrefslogtreecommitdiffstats
path: root/osdep/getch2.c
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/getch2.c')
-rw-r--r--osdep/getch2.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/osdep/getch2.c b/osdep/getch2.c
index c104790900..a4226415f0 100644
--- a/osdep/getch2.c
+++ b/osdep/getch2.c
@@ -28,6 +28,11 @@
#endif
#endif
+#if defined(USE_LANGINFO) && defined(USE_ICONV)
+#include <locale.h>
+#include <langinfo.h>
+#endif
+
#include <unistd.h>
#include "keycodes.h"
@@ -238,3 +243,16 @@ void getch2_disable(void){
getch2_status=0;
}
+#ifdef USE_ICONV
+char* get_term_charset()
+{
+ char* charset = NULL;
+#ifdef USE_LANGINFO
+ setlocale(LC_CTYPE, "");
+ charset = nl_langinfo(CODESET);
+ setlocale(LC_CTYPE, "C");
+#endif
+ return charset;
+}
+#endif
+