summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 15:39:56 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 15:39:56 +0000
commit2f2497ee534fe7cdc5ffab2bda5e7446b9f42b76 (patch)
tree3f627152b86976f39249d246480e32807b2523ef /encoding.c
parent2a71b1ca87fbb96e1d4fe6ed598d6e931034d0c4 (diff)
merges r21517 and r21519 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@21565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/encoding.c b/encoding.c
index 858f4e70e5..141796680e 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1218,11 +1218,11 @@ 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];
- if (codeset) {
+ if (!codeset) {
snprintf(cp, sizeof(cp), "CP%d", GetConsoleCP());
codeset = cp;
}
@@ -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