ruby-changes:43872
From: nobu <ko1@a...>
Date: Tue, 16 Aug 2016 22:01:35 +0900 (JST)
Subject: [ruby-changes:43872] nobu:r55945 (trunk): open Unicode data in binary mode
nobu 2016-08-16 22:01:30 +0900 (Tue, 16 Aug 2016) New Revision: 55945 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55945 Log: 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. Modified files: trunk/template/unicode_norm_gen.tmpl trunk/tool/enc-unicode.rb Index: template/unicode_norm_gen.tmpl =================================================================== --- template/unicode_norm_gen.tmpl (revision 55944) +++ template/unicode_norm_gen.tmpl (revision 55945) @@ -66,7 +66,7 @@ class Array https://github.com/ruby/ruby/blob/trunk/template/unicode_norm_gen.tmpl#L66 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 Index: tool/enc-unicode.rb =================================================================== --- tool/enc-unicode.rb (revision 55944) +++ tool/enc-unicode.rb (revision 55945) @@ -281,7 +281,7 @@ def data_foreach(name, &block) https://github.com/ruby/ruby/blob/trunk/tool/enc-unicode.rb#L281 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" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/