Skip to content

Commit 110dbbc

Browse files
committed
Fix require_relative to load files from non-ASCII paths
Closes oneclick/rubyinstaller2#265
1 parent 1be669d commit 110dbbc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

localeinit.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ locale_charmap(VALUE (*conv)(const char *))
4747
# endif
4848
if (!codeset) {
4949
UINT codepage = ruby_w32_codepage[0];
50-
if (!codepage) codepage = GetConsoleCP();
51-
if (!codepage) codepage = GetACP();
50+
if (!codepage) codepage = CP_UTF8;
5251
CP_FORMAT(cp, codepage);
5352
codeset = cp;
5453
}

ruby.c

+4
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,11 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
19821982
ruby_init_loadpath();
19831983

19841984
Init_enc();
1985+
#ifdef _WIN32
1986+
lenc = rb_utf8_encoding();
1987+
#else
19851988
lenc = rb_locale_encoding();
1989+
#endif
19861990
rb_enc_associate(rb_progname, lenc);
19871991
rb_obj_freeze(rb_progname);
19881992
parser = rb_parser_new();

0 commit comments

Comments
 (0)