summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 04:50:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 04:50:48 +0000
commit60e38b6efb7582f3c419ec7b06ed9579e4310b43 (patch)
tree3bd2da33d3ce33cb720189501e0ba4df5b3a2964 /ruby.c
parenta7b36aebe8d99906a37a87747d94e81b5909cac9 (diff)
* ruby.c (load_file): script files should not be affected by locale.
[ruby-dev:33054] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index d8e698c073..e3b700bdc1 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1151,8 +1151,12 @@ 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());
+ if (opt->enc_index >= 0) {
+ rb_enc_associate_index(f, opt->enc_index);
+ }
+ else if (f == rb_stdin) {
+ 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);