From 2b6fa9eb0d9b021bb861b6693eac5307e265108e Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 6 Oct 2014 03:08:13 +0000 Subject: unicode_norm_gen.rb: us-ascii * tool/unicode_norm_gen.rb (Integer#to_UTF8): escape non-ascii code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/unicode_norm_gen.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tool') diff --git a/tool/unicode_norm_gen.rb b/tool/unicode_norm_gen.rb index 982f3f077c..7fceaefb03 100644 --- a/tool/unicode_norm_gen.rb +++ b/tool/unicode_norm_gen.rb @@ -14,10 +14,10 @@ class Integer 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 " # generate normalization tables file open("#{OuputDataDir}/normalize_tables.rb", "w").print <