win32: Use UTF-8 as filesystem encoding [Feature #12654]

Co-Authored-By: Dāvis Mosāns <davispuh@gmail.com>
This commit is contained in:
Nobuyoshi Nakada 2020-12-20 02:16:31 +09:00
parent feea436feb
commit 5b98b2ce39
Notes: git 2020-12-20 18:34:28 +09:00
6 changed files with 37 additions and 59 deletions

View file

@ -123,8 +123,9 @@ Init_enc_set_filesystem_encoding(void)
idx = ENCINDEX_US_ASCII;
#elif defined _WIN32
char cp[SIZEOF_CP_NAME];
const UINT codepage = ruby_w32_codepage[1] ? ruby_w32_codepage[1] :
AreFileApisANSI() ? GetACP() : GetOEMCP();
const UINT codepage = ruby_w32_codepage[1];
if (!codepage) return ENCINDEX_UTF_8;
/* for debugging */
CP_FORMAT(cp, codepage);
idx = rb_enc_find_index(cp);
if (idx < 0) idx = ENCINDEX_ASCII;