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
This commit is contained in:
parent
240b12c6fc
commit
2b6fa9eb0d
@ -14,10 +14,10 @@ class Integer
|
|||||||
def to_UTF8() # convert to string, taking legibility into account
|
def to_UTF8() # convert to string, taking legibility into account
|
||||||
if self>0xFFFF
|
if self>0xFFFF
|
||||||
"\\u{#{to_s(16).upcase}}"
|
"\\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')}"
|
"\\u#{to_s(16).upcase.rjust(4, '0')}"
|
||||||
else
|
else
|
||||||
chr Encoding::UTF_8
|
chr.sub(/[\\\"]/, '\\\&')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -136,7 +136,7 @@ end.line_slice "\n "
|
|||||||
|
|
||||||
# generate normalization tables file
|
# generate normalization tables file
|
||||||
open("#{OuputDataDir}/normalize_tables.rb", "w").print <<MAPPING_TABLE_FILE_END
|
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
|
# automatically generated by tool/unicode_norm_gen.rb
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user