diff options
author | Lars Kanis <kanis@comcard.de> | 2020-12-07 17:48:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 01:48:37 +0900 |
commit | 94b6933d1c6f4c8698319fbcac9dcecc9033b4b9 (patch) | |
tree | 6950fff7edffd487a5fd40b154e8f875bddecd82 /ruby.c | |
parent | 3bf7b999e503199e2e9fe68ade25ee6830b3e57e (diff) |
Set default for Encoding.default_external to UTF-8 on Windows (#2877)
* Use UTF-8 as default for Encoding.default_external on Windows
* Document UTF-8 change on Windows to Encoding.default_external
fix https://bugs.ruby-lang.org/issues/16604
Notes
Notes:
Merged-By: nurse <naruse@airemix.jp>
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1819,6 +1819,9 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) Init_ruby_description(); Init_enc(); lenc = rb_locale_encoding(); +#if UTF8_PATH + uenc = rb_utf8_encoding(); +#endif rb_enc_associate(rb_progname, lenc); rb_obj_freeze(rb_progname); parser = rb_parser_new(); @@ -1839,7 +1842,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) enc = rb_enc_from_index(opt->ext.enc.index); } else { - enc = lenc; + enc = IF_UTF8_PATH(uenc, lenc); } rb_enc_set_default_external(rb_enc_from_encoding(enc)); if (opt->intern.enc.index >= 0) { @@ -1944,7 +1947,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) enc = rb_enc_from_index(opt->ext.enc.index); } else { - enc = lenc; + enc = IF_UTF8_PATH(uenc, lenc); } rb_enc_set_default_external(rb_enc_from_encoding(enc)); if (opt->intern.enc.index >= 0) { |