From 86c50e39838fc5831163e3b92a9047d539fb46ee Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 30 Oct 2008 09:17:49 +0000 Subject: [PATCH] * ruby.c (load_file_internal): should not set script encoding to ASCII-8BIT. * ruby.c (load_file_internal): do not auto convert scripts even when default_internal is set. [ruby-core:19579] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 ++++++++--- ruby.c | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c918caebd6..95313ae649 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,14 @@ Thu Oct 30 09:31:45 2008 Nobuyoshi Nakada * encoding.c (rb_enc_set_default_internal): ditto for internal. +Thu Oct 30 03:30:25 2008 Yukihiro Matsumoto + + * ruby.c (load_file_internal): should not set script encoding to + ASCII-8BIT. + + * ruby.c (load_file_internal): do not auto convert scripts even + when default_internal is set. [ruby-core:19579] + Thu Oct 30 02:20:33 2008 Yusuke Endoh * array.c (rb_ary_sort_bang): remove SEGV when replacing array with @@ -123,9 +131,6 @@ Wed Oct 29 11:00:25 2008 NAKAMURA Usaku Wed Oct 29 09:30:04 2008 Nobuyoshi Nakada - * ruby.c (load_file_internal): use ASCII-8BIT to prevent conversion. - [ruby-core:19579] - * ruby.c (load_file_internal): cache common interned IDs. Wed Oct 29 00:43:39 2008 Tadayoshi Funaba diff --git a/ruby.c b/ruby.c index eb93fc3dfe..b0e8bcb2c3 100644 --- a/ruby.c +++ b/ruby.c @@ -1381,9 +1381,9 @@ load_file_internal(VALUE arg) enc = rb_locale_encoding(); } else { - enc = rb_ascii8bit_encoding(); + enc = rb_usascii_encoding(); } - rb_funcall(f, set_encoding, 1, rb_enc_from_encoding(enc)); + rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-")); tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start); rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser)); if (script && rb_parser_end_seen_p(parser)) {