ruby-changes:35732
From: nobu <ko1@a...>
Date: Mon, 6 Oct 2014 12:08:38 +0900 (JST)
Subject: [ruby-changes:35732] nobu:r47814 (trunk): unicode_norm_gen.rb: us-ascii
nobu 2014-10-06 12:08:13 +0900 (Mon, 06 Oct 2014) New Revision: 47814 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47814 Log: unicode_norm_gen.rb: us-ascii * tool/unicode_norm_gen.rb (Integer#to_UTF8): escape non-ascii code. Modified files: trunk/tool/unicode_norm_gen.rb Index: tool/unicode_norm_gen.rb =================================================================== --- tool/unicode_norm_gen.rb (revision 47813) +++ tool/unicode_norm_gen.rb (revision 47814) @@ -14,10 +14,10 @@ class Integer https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L14 def to_UTF8() # convert to string, taking legibility into account if self>0xFFFF "\\u{#{to_s(16).upcase}}" - elsif CombiningClass[self] or self=='\\'.ord or self=='"'.ord + elsif self>0x7f "\\u#{to_s(16).upcase.rjust(4, '0')}" else - chr Encoding::UTF_8 + chr.sub(/[\\\"]/, '\\\&') end end end @@ -136,7 +136,7 @@ end.line_slice "\n " https://github.com/ruby/ruby/blob/trunk/tool/unicode_norm_gen.rb#L136 # generate normalization tables file open("#{OuputDataDir}/normalize_tables.rb", "w").print <<MAPPING_TABLE_FILE_END -# coding: utf-8 +# coding: us-ascii # automatically generated by tool/unicode_norm_gen.rb -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/