diff --git a/ChangeLog b/ChangeLog index 4e26a62d59..53091f0c2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Oct 19 11:09:56 2007 Nobuyoshi Nakada + + * ruby.c (process_options): set primary encoding from the parser + always. [ruby-core:12758] + + * ruby.c (load_file): should not discard the parser parameter. + Fri Oct 19 10:55:42 2007 Nobuyoshi Nakada * range.c (range_last): removed unused variables. diff --git a/ruby.c b/ruby.c index 97d5d38a56..ffdf45a151 100644 --- a/ruby.c +++ b/ruby.c @@ -842,7 +842,6 @@ process_options(VALUE arg) char **argv = opt->argv; NODE *tree = 0; VALUE parser; - VALUE encoding; const char *s; int i = proc_options(argc, argv, opt); @@ -970,13 +969,7 @@ process_options(VALUE arg) } } - if (opt->enc_index >= 0) { - encoding = rb_enc_from_encoding(rb_enc_from_index(opt->enc_index)); - } - else { - encoding = rb_parser_encoding(parser); - } - rb_set_primary_encoding(encoding); + rb_set_primary_encoding(rb_parser_encoding(parser)); return (VALUE)tree; } @@ -1097,7 +1090,6 @@ load_file(VALUE parser, const char *fname, int script, struct cmdline_options *o require_libraries(); /* Why here? unnatural */ } if (opt->enc_index >= 0) rb_enc_associate_index(f, opt->enc_index); - parser = rb_parser_new(); tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start); if (script && rb_parser_end_seen_p(parser)) { rb_define_global_const("DATA", f);