ruby-changes:3796
From: ko1@a...
Date: Mon, 28 Jan 2008 11:26:45 +0900 (JST)
Subject: [ruby-changes:3796] usa - Ruby:r15285 (trunk): * parse.y (parser_str_new): encoding of UTF-8 literal string in
usa 2008-01-28 11:26:23 +0900 (Mon, 28 Jan 2008) New Revision: 15285 Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ruby/test_m17n.rb Log: * parse.y (parser_str_new): encoding of UTF-8 literal string in US-ASCII script is UTF-8. [ruby-dev:33406] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=15285&r2=15284&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15285&r2=15284&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_m17n.rb?r1=15285&r2=15284&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15284) +++ ChangeLog (revision 15285) @@ -1,3 +1,8 @@ +Mon Jan 28 11:24:49 2008 NAKAMURA Usaku <usa@r...> + + * parse.y (parser_str_new): encoding of UTF-8 literal string in + US-ASCII script is UTF-8. [ruby-dev:33406] + Mon Jan 28 10:25:59 2008 NAKAMURA Usaku <usa@r...> * test/ruby/test_m17n.rb (test_magic_comment): add test. Index: parse.y =================================================================== --- parse.y (revision 15284) +++ parse.y (revision 15285) @@ -4848,7 +4848,7 @@ if (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) { rb_enc_associate(str, rb_usascii_encoding()); } - else if (enc0 == rb_usascii_encoding()) { + else if (enc0 == rb_usascii_encoding() && enc != rb_utf8_encoding()) { rb_enc_associate(str, rb_ascii8bit_encoding()); } } Index: test/ruby/test_m17n.rb =================================================================== --- test/ruby/test_m17n.rb (revision 15284) +++ test/ruby/test_m17n.rb (revision 15285) @@ -153,6 +153,7 @@ def test_utf8_literal assert_equal(Encoding::UTF_8, "\u3042".encoding, "[ruby-dev:33406] \"\\u3042\".encoding") + assert_raise(SyntaxError) { eval(a('\u3052\x80')) } end def test_string_mixed_unicode -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/