Skip to content

Commit

Permalink
Fix require_relative to load files from non-ASCII paths
Browse files Browse the repository at this point in the history
  • Loading branch information
larskanis committed Oct 27, 2023
1 parent 1be669d commit 110dbbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions localeinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ locale_charmap(VALUE (*conv)(const char *))
# endif
if (!codeset) {
UINT codepage = ruby_w32_codepage[0];
if (!codepage) codepage = GetConsoleCP();
if (!codepage) codepage = GetACP();
if (!codepage) codepage = CP_UTF8;
CP_FORMAT(cp, codepage);
codeset = cp;
}
Expand Down
4 changes: 4 additions & 0 deletions ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,11 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
ruby_init_loadpath();

Init_enc();
#ifdef _WIN32
lenc = rb_utf8_encoding();
#else
lenc = rb_locale_encoding();
#endif
rb_enc_associate(rb_progname, lenc);
rb_obj_freeze(rb_progname);
parser = rb_parser_new();
Expand Down

0 comments on commit 110dbbc

Please sign in to comment.