diff options
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 31 |
1 files changed, 7 insertions, 24 deletions
@@ -1008,33 +1008,21 @@ process_options(VALUE arg) enc = rb_enc_from_index(opt->ext.enc.index); } else { - enc = 0; + enc = rb_locale_encoding(); } if (opt->e_script) { - rb_encoding *eenc = rb_locale_encoding(); - if (!enc) { - enc = eenc; - } - else if (!rb_enc_asciicompat(enc)) { - rb_warning("%s is not ASCII compatible, ignored for -e", - rb_enc_name(enc)); - } - else if (eenc != enc && - (rb_enc_str_coderange(opt->e_script) != ENC_CODERANGE_7BIT)) { - rb_warning("-e conatains non ASCII string, encoding %s is not used", - rb_enc_name(enc)); + rb_encoding *eenc; + if (opt->src.enc.index >= 0) { + eenc = rb_enc_from_index(opt->src.enc.index); } else { - eenc = enc; + eenc = rb_locale_encoding(); } rb_enc_associate(opt->e_script, eenc); require_libraries(); tree = rb_parser_compile_string(parser, opt->script, opt->e_script, 1); } else { - if (!enc) { - enc = rb_locale_encoding(); - } if (opt->script[0] == '-' && !opt->script[1]) { forbid_setid("program input from stdin"); } @@ -1199,15 +1187,10 @@ load_file(VALUE parser, const char *fname, int script, struct cmdline_options *o enc = rb_enc_from_index(opt->src.enc.index); } else if (f == rb_stdin) { - if (opt->ext.enc.index >= 0) { - enc = rb_enc_from_index(opt->ext.enc.index); - } - else { - enc = rb_locale_encoding(); - } + enc = rb_locale_encoding(); } else { - enc = rb_ascii8bit_encoding(); + enc = rb_usascii_encoding(); } rb_funcall(f, rb_intern("set_encoding"), 1, rb_enc_from_encoding(enc)); tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start); |