summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-26 11:16:23 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-26 11:16:23 +0000
commitcad814b5485493a5db2543bcf876bc117055cbf7 (patch)
tree3e9004699f7975c1376fde9aef04a932edabf519
parent8309a878a9c61726f03809cf918f17601b9e39c4 (diff)
merges r20905 from trunk into ruby_1_9_1.
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--parse.y8
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e029ba511..b78f25a57f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Mon Dec 22 09:54:43 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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.
+
Fri Dec 26 15:50:45 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (OptionParser::List#summarize): gives priority
diff --git a/parse.y b/parse.y
index bb9e81ce18..843f14fda1 100644
--- a/parse.y
+++ b/parse.y
@@ -7931,7 +7931,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));