diff --git a/ChangeLog b/ChangeLog index 440bde2496..55238ee24b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Dec 22 09:54:43 2008 Yukihiro Matsumoto + + * parse.y (gettable_gen): the encoding of __FILE__ should be + rb_filesystem_encoding(). [ruby-list:45733] + + * parse.y (gettable_gen): __FILE__ should be ASCII-8BIT when + filesystem encoding is US-ASCII and __FILE__ contains non 7bit + characters. + Mon Dec 22 02:54:56 2008 Hidetoshi NAGAI * ext/tk/lib/tk.rb: temporary patch for trouble on TkAqua (> Tk8.4.9). diff --git a/parse.y b/parse.y index ceb3b93417..f99277ec97 100644 --- a/parse.y +++ b/parse.y @@ -7923,7 +7923,13 @@ gettable_gen(struct parser_params *parser, ID id) return NEW_FALSE(); } else if (id == keyword__FILE__) { - return NEW_STR(STR_NEW2(ruby_sourcefile)); + VALUE str = rb_external_str_new_with_enc(ruby_sourcefile, strlen(ruby_sourcefile), + rb_filesystem_encoding()); + if (rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT && + ENCODING_GET(str) == rb_usascii_encindex()) { + rb_enc_associate(str, rb_ascii8bit_encoding()); + } + return NEW_STR(str); } else if (id == keyword__LINE__) { return NEW_LIT(INT2FIX(ruby_sourceline));