1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Initialize UTF-8 encoding first as it is used always now

This commit is contained in:
Nobuyoshi Nakada 2020-11-23 09:16:16 +09:00
parent d83aa3c2f5
commit afd765f2ee
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

6
ruby.c
View file

@ -1656,7 +1656,8 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
const rb_iseq_t *iseq;
rb_encoding *enc, *lenc;
#if UTF8_PATH
rb_encoding *uenc, *ienc = 0;
rb_encoding *ienc = 0;
rb_encoding *const uenc = rb_utf8_encoding();
#endif
const char *s;
char fbuf[MAXPATHLEN];
@ -1850,8 +1851,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
#endif
}
script_name = opt->script_name;
rb_enc_associate(opt->script_name,
IF_UTF8_PATH(uenc = rb_utf8_encoding(), lenc));
rb_enc_associate(opt->script_name, IF_UTF8_PATH(uenc, lenc));
#if UTF8_PATH
if (uenc != lenc) {
opt->script_name = str_conv_enc(opt->script_name, uenc, lenc);