summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 04:10:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 04:10:16 +0000
commitece0628ebe83bce6968f7f47ce5898266b8e8410 (patch)
treec8b37c4eff2aee9bb91ed7fa70d9a280f18b2c54
parent9e99ce38313cda42a4e2c6c0dba8d1356eec2c7f (diff)
* configure.in, win32/Makefile.sub (MISSING): added langinfo on mingw
and mswin. * encoding.c (rb_locale_charmap): use environments on mingw and mswin. * missing/langinfo.c (nl_langinfo_codeset): MS-Windows Japanese environment uses Windows-31J derived from Shift_JIS, not EUC-JP. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--configure.in1
-rw-r--r--encoding.c4
-rw-r--r--missing/langinfo.c9
-rw-r--r--win32/Makefile.sub2
5 files changed, 20 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index c6b741300b..406a87c0de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Jan 15 13:10:09 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in, win32/Makefile.sub (MISSING): added langinfo on mingw
+ and mswin.
+
+ * encoding.c (rb_locale_charmap): use environments on mingw and mswin.
+
+ * missing/langinfo.c (nl_langinfo_codeset): MS-Windows Japanese
+ environment uses Windows-31J derived from Shift_JIS, not EUC-JP.
+
Thu Jan 15 12:10:39 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/Makefile.sub ($(INSNS), node_name.inc, known_errors.inc,
diff --git a/configure.in b/configure.in
index b0d14a01a6..99cbf4f419 100644
--- a/configure.in
+++ b/configure.in
@@ -599,6 +599,7 @@ mingw*) LIBS="-lshell32 -lws2_32 $LIBS"
rb_cv_binary_elf=no
rb_cv_negative_time_t=no
ac_cv_func_fcntl=yes
+ AC_LIBOBJ([langinfo])
;;
os2-emx*) LIBS="-lm $LIBS"
ac_cv_lib_dir_opendir=no;;
diff --git a/encoding.c b/encoding.c
index 858f4e70e5..2abd0b1f16 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1218,7 +1218,7 @@ rb_locale_charmap(VALUE klass)
{
#if defined NO_LOCALE_CHARMAP
return rb_usascii_str_new2("ASCII-8BIT");
-#elif defined __CYGWIN__
+#elif defined _WIN32 || defined __CYGWIN__
const char *nl_langinfo_codeset(void);
const char *codeset = nl_langinfo_codeset();
char cp[sizeof(int) * 3 + 4];
@@ -1231,8 +1231,6 @@ rb_locale_charmap(VALUE klass)
char *codeset;
codeset = nl_langinfo(CODESET);
return rb_usascii_str_new2(codeset);
-#elif defined _WIN32
- return rb_sprintf("CP%d", GetConsoleCP());
#else
return Qnil;
#endif
diff --git a/missing/langinfo.c b/missing/langinfo.c
index bbc81f5c41..a76000bc77 100644
--- a/missing/langinfo.c
+++ b/missing/langinfo.c
@@ -36,7 +36,6 @@
#include <string.h>
#if defined _WIN32 || defined __CYGWIN__
#include <windows.h>
-int snprintf(char *, size_t, const char *, ...);
#if defined _WIN32
#define strncasecmp strnicmp
#endif
@@ -49,6 +48,12 @@ int snprintf(char *, size_t, const char *, ...);
* C/POSIX locale. Could as well one day
* become "UTF-8". */
+#if defined _WIN32 || defined __CYGWIN__
+#define JA_CODESET "Windows-31J"
+#else
+#define JA_CODESET "EUC-JP"
+#endif
+
#define digit(x) ((x) >= '0' && (x) <= '9')
#define strstart(s, n) (strncasecmp(s, n, strlen(n)) == 0)
@@ -94,7 +99,7 @@ nl_langinfo_codeset(void)
if (strstart(l, "zh_TW")) return "Big5";
if (strstart(l, "zh_HK")) return "Big5HKSCS"; /* no MIME charset */
if (strstart(l, "zh")) return "GB2312";
- if (strstart(l, "ja")) return "EUC-JP";
+ if (strstart(l, "ja")) return JA_CODESET;
if (strstart(l, "ko")) return "EUC-KR";
if (strstart(l, "ru")) return "KOI8-R";
if (strstart(l, "uk")) return "KOI8-U";
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 574681bcd6..99da2f364f 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -177,7 +177,7 @@ EXTLIBS =
LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib $(EXTLIBS)
!endif
!if !defined(MISSING)
-MISSING = acosh.obj cbrt.obj crypt.obj erf.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32.obj
+MISSING = acosh.obj cbrt.obj crypt.obj erf.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32.obj langinfo.obj
!endif
ARFLAGS = -machine:$(MACHINE) -out: