summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-06 03:08:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-06 03:08:13 +0000
commit2b6fa9eb0d9b021bb861b6693eac5307e265108e (patch)
tree5bf5eebbcb643db4cb20af2dcd10faddcd6af08c /tool
parent240b12c6fc5237e0b90441d942fac10a89463b3e (diff)
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
Diffstat (limited to 'tool')
-rw-r--r--tool/unicode_norm_gen.rb6
1 files changed, 3 insertions, 3 deletions
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 <<MAPPING_TABLE_FILE_END
-# coding: utf-8
+# coding: us-ascii
# automatically generated by tool/unicode_norm_gen.rb