summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-11 19:41:22 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-11 19:41:22 +0000
commit7f9c3b1c973a1785cd1471d86d8875caf17f0a7e (patch)
treef921b2660ac1566b1b11b647ab5677b01c33d318
parent353a69229dcedd1991b710085a37d6c331816a92 (diff)
* ruby.c (process_options): -e'script' is locale encoding by default.
(load_file): ruby script from stdin is locale encoding by default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ruby.c16
2 files changed, 13 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e05641d21..9326f8e364 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jan 12 04:38:38 2008 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ruby.c (process_options): -e'script' is locale encoding by default.
+ (load_file): ruby script from stdin is locale encoding by default.
+
Sat Jan 12 04:31:59 2008 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c: fix bug: -m was -m0.
diff --git a/ruby.c b/ruby.c
index dd0f4b6698..5bb0065fec 100644
--- a/ruby.c
+++ b/ruby.c
@@ -984,9 +984,14 @@ process_options(VALUE arg)
if (opt->enc_name != 0) {
opt->enc_index = opt_enc_index(opt->enc_name);
}
+ if (opt->enc_index >= 0) {
+ enc = rb_enc_from_index(opt->enc_index);
+ }
+ else {
+ enc = rb_locale_encoding();
+ }
if (opt->e_script) {
- if (opt->enc_index >= 0)
- rb_enc_associate_index(opt->e_script, opt->enc_index);
+ rb_enc_associate(opt->e_script, enc);
require_libraries();
tree = rb_parser_compile_string(parser, opt->script, opt->e_script, 1);
}
@@ -1021,12 +1026,6 @@ process_options(VALUE arg)
}
}
- if (opt->enc_index >= 0) {
- enc = rb_enc_from_index(opt->enc_index);
- }
- else {
- enc = rb_locale_encoding();
- }
rb_enc_set_default_external(rb_enc_from_encoding(enc));
return (VALUE)tree;
@@ -1153,6 +1152,7 @@ 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);
+ else rb_enc_associate(f, rb_locale_encoding());
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);