summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-16 13:01:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-16 13:01:30 +0000
commit2ae5e54e62c1525d6058c35c4bd86b04a45384c4 (patch)
treec64cbe684159ce0d69a2738231b8288d4c235304
parentfc95326e1f6bb38554709680ac0b97370d758a59 (diff)
open Unicode data in binary mode
* tool/enc-unicode.rb (data_foreach): open in binary mode because Unicode 9.0.0 contains non-ascii characters. * template/unicode_norm_gen.tmpl: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--template/unicode_norm_gen.tmpl2
-rwxr-xr-xtool/enc-unicode.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/template/unicode_norm_gen.tmpl b/template/unicode_norm_gen.tmpl
index 161f23e5e7..c8d697cb34 100644
--- a/template/unicode_norm_gen.tmpl
+++ b/template/unicode_norm_gen.tmpl
@@ -66,7 +66,7 @@ class Array
end
# read the file 'CompositionExclusions.txt'
-composition_exclusions = vpath.open("#{InputDataDir}/CompositionExclusions.txt") {|f|
+composition_exclusions = vpath.open("#{InputDataDir}/CompositionExclusions.txt", 'rb') {|f|
base = Regexp.quote(File.basename(f.path, '.*'))
ext = Regexp.quote(File.extname(f.path))
version = (line = f.gets)[/^# *#{base}-([\d.]+)#{ext}\s*$/, 1] or
diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb
index e7b979a639..83bbe352e1 100755
--- a/tool/enc-unicode.rb
+++ b/tool/enc-unicode.rb
@@ -281,7 +281,7 @@ def data_foreach(name, &block)
fn = get_file(name)
warn "Reading #{name}"
pat = /^# #{name.sub(/\./, '-([\\d.]+)\\.')}/
- File.open(fn) do |f|
+ File.open(fn, 'rb') do |f|
line = f.gets
unless pat =~ line
raise ArgumentError, "#{name}: no Unicode version"