summaryrefslogtreecommitdiff
path: root/ext/nkf
diff options
context:
space:
mode:
Diffstat (limited to 'ext/nkf')
-rw-r--r--ext/nkf/nkf-utf8/nkf.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/ext/nkf/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c
index fa4ce4fdf5..4354d05517 100644
--- a/ext/nkf/nkf-utf8/nkf.c
+++ b/ext/nkf/nkf-utf8/nkf.c
@@ -33,7 +33,7 @@
***********************************************************************/
#define NKF_IDENT "$Id$"
#define NKF_VERSION "2.0.8"
-#define NKF_RELEASE_DATE "2008-02-08"
+#define NKF_RELEASE_DATE "2008-10-28"
#define COPY_RIGHT \
"Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW\n" \
"Copyright (C) 2002-2008 Kono, Furukawa, Naruse, mastodon"
@@ -41,6 +41,10 @@
#include "config.h"
#include "nkf.h"
#include "utf8tbl.h"
+#ifdef __WIN32__
+#include <windows.h>
+#include <locale.h>
+#endif
/* state of output_mode and input_mode
@@ -718,7 +722,16 @@ nkf_locale_charmap()
#ifdef HAVE_LANGINFO_H
return nl_langinfo(CODESET);
#elif defined(__WIN32__)
- return sprintf("CP%d", GetACP());
+ char buf[16];
+ char *str;
+ int len = sprintf(buf, "CP%d", GetACP());
+ if (len > 0) {
+ str = malloc(len + 1);
+ strcpy(str, buf);
+ str[len] = '\0';
+ return str;
+ }
+ else return NULL;
#else
return NULL;
#endif
@@ -4100,7 +4113,7 @@ numchar_getc(FILE *f)
nkf_char (*g)(FILE *) = i_ngetc;
nkf_char (*u)(nkf_char c ,FILE *f) = i_nungetc;
int i = 0, j;
- nkf_char buf[8];
+ nkf_char buf[12];
long c = -1;
buf[i] = (*g)(f);
@@ -5328,6 +5341,10 @@ kanji_convert(FILE *f)
SEND;
}
}
+ else if (nkf_char_unicode_p(c1)) {
+ (*oconv)(0, c1);
+ NEXT;
+ }
else {
/* first byte */
if (input_mode == JIS_X_0208 && DEL <= c1 && c1 < 0x92) {