mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue