summaryrefslogtreecommitdiff
path: root/localeinit.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 02:16:31 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 18:34:04 +0900
commit5b98b2ce39ed979aec614365a2dc3e1c30052bca (patch)
tree975744f4a5cd9e523f8e319dd6d017c08580de21 /localeinit.c
parentfeea436febb50eb4265bd985a550e384c606122c (diff)
win32: Use UTF-8 as filesystem encoding [Feature #12654]
Co-Authored-By: Dāvis Mosāns <davispuh@gmail.com>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3948
Diffstat (limited to 'localeinit.c')
-rw-r--r--localeinit.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/localeinit.c b/localeinit.c
index bec29a6d46..bbcbac832e 100644
--- a/localeinit.c
+++ b/localeinit.c
@@ -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;