mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* encoding.c (rb_locale_charmap): fallback to codepage if no
locale is found. [ruby-core:21110] * missing/langinfo.c (nl_langinfo_codeset): returns NULL if no locale is found. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3d829c8697
commit
22e711c4bf
3 changed files with 58 additions and 28 deletions
|
@ -1218,6 +1218,15 @@ rb_locale_charmap(VALUE klass)
|
|||
{
|
||||
#if defined NO_LOCALE_CHARMAP
|
||||
return rb_usascii_str_new2("ASCII-8BIT");
|
||||
#elif defined __CYGWIN__
|
||||
const char *nl_langinfo_codeset(void);
|
||||
const char *codeset = nl_langinfo_codeset();
|
||||
char cp[sizeof(int) * 3 + 4];
|
||||
if (codeset) {
|
||||
snprintf(cp, sizeof(cp), "CP%d", GetConsoleCP());
|
||||
codeset = cp;
|
||||
}
|
||||
return rb_usascii_str_new2(codeset);
|
||||
#elif defined HAVE_LANGINFO_H
|
||||
char *codeset;
|
||||
codeset = nl_langinfo(CODESET);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue