Bug #4854 ยป encoding.codepage.patch
| encoding.c (working copy) | ||
|---|---|---|
|
const char *codeset = nl_langinfo_codeset();
|
||
|
char cp[sizeof(int) * 3 + 4];
|
||
|
if (!codeset) {
|
||
|
snprintf(cp, sizeof(cp), "CP%d", GetConsoleCP());
|
||
|
UINT codepage = GetConsoleCP();
|
||
|
if(codepage==0) {
|
||
|
codepage = GetACP();
|
||
|
}
|
||
|
snprintf(cp, sizeof(cp), "CP%d", codepage);
|
||
|
codeset = cp;
|
||
|
}
|
||
|
return rb_usascii_str_new2(codeset);
|
||