# include <ncurses.h>
#else
# include <curses.h>
-#endif
+#include <iconv.h>
typedef struct term_data term_data;
#define MAX_TERM_DATA 4
static term_data data[MAX_TERM_DATA];
-
+static iconv_t iconvd;
/*
* Hack -- try to guess which systems use what commands
term_data *td = (term_data *)(Term->data);
int i;
-
- char text[81];
+ char intext[n];
+ char text[80 * 3 + 1];
+ size_t inlen = n;
+ size_t outlen = sizeof(text);
+ char *inbuf = intext;
+ char *outbuf = text;
+ size_t res;
#ifdef USE_NCURSES_ACS
/* do we have colors + 16 ? */
}
#endif
+ /* Copy to char array because of iconv's warning by const char pointer */
+ memcpy(intext, s, (size_t)n);
+
/* Obtain a copy of the text */
- for (i = 0; i < n; i++) text[i] = s[i]; text[n] = 0;
+ if(res == (size_t)-1) return (-1);
+ if(res == (size_t)-1) return (-1);
+ res = iconv(iconvd, 0, 0, &outbuf, &outlen);
+ if(res == (size_t)-1) return (-1);
+
+ if(outlen == 0) return (-1);
+ *outbuf = '\0';
/* Move the cursor and dump the string */
wmove(td->win, y, x);
-
#ifdef A_COLOR
/* Set the color */
if (can_use_color) wattrset(td->win, colortable[a & 0x0F]);
/* Unused */
(void)str;
- /* Exit curses */
- endwin();
+ /* Exit curses */
+ endwin();
+
+ iconv_close(iconvd);
}
setlocale(LC_ALL, "");
+ iconvd = iconv_open("", "EUC-JP");
+ if(iconvd == (iconv_t)-1) return (-1);
#ifdef USE_SOUND