diff options
author | Michael Koziarski <michael@koziarski.com> | 2006-10-04 09:03:57 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2006-10-04 09:03:57 +0000 |
commit | e89919082624effcd70208eb58c4e2d90b57a2a9 (patch) | |
tree | 7117b6a06dd10a05c9c37c323ce6ce161590c267 /activesupport/lib/active_support/multibyte/generators/generate_tables.rb | |
parent | f238d495b70a264abdb864fe8107e02766b285b4 (diff) | |
download | rails-e89919082624effcd70208eb58c4e2d90b57a2a9.tar.gz rails-e89919082624effcd70208eb58c4e2d90b57a2a9.tar.bz2 rails-e89919082624effcd70208eb58c4e2d90b57a2a9.zip |
Pull in latest multibyte patch. Closes #6346 [Manfred Stienstra]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/multibyte/generators/generate_tables.rb')
-rw-r--r-- | activesupport/lib/active_support/multibyte/generators/generate_tables.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/multibyte/generators/generate_tables.rb b/activesupport/lib/active_support/multibyte/generators/generate_tables.rb index 4045b94282..7f807585c5 100644 --- a/activesupport/lib/active_support/multibyte/generators/generate_tables.rb +++ b/activesupport/lib/active_support/multibyte/generators/generate_tables.rb @@ -18,7 +18,8 @@ module ActiveSupport::Multibyte::Handlers #:nodoc: SOURCES = { :codepoints => BASE_URI + 'UnicodeData.txt', :composition_exclusion => BASE_URI + 'CompositionExclusions.txt', - :grapheme_break_property => BASE_URI + 'auxiliary/GraphemeBreakProperty.txt' + :grapheme_break_property => BASE_URI + 'auxiliary/GraphemeBreakProperty.txt', + :cp1252 => 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT' } def initialize @@ -33,6 +34,7 @@ module ActiveSupport::Multibyte::Handlers #:nodoc: @ucd.composition_exclusion = [] @ucd.composition_map = {} @ucd.boundary = {} + @ucd.cp1252 = {} end def parse_codepoints(line) @@ -87,6 +89,12 @@ module ActiveSupport::Multibyte::Handlers #:nodoc: end end + def parse_cp1252(line) + if line =~ /^([0-9A-Fx]+)\s([0-9A-Fx]+)/i + @ucd.cp1252[$1.hex] = $2.hex + end + end + def create_composition_map @ucd.codepoints.each do |_, cp| if !cp.nil? and cp.combining_class == 0 and cp.decomp_type.nil? and !cp.decomp_mapping.nil? and cp.decomp_mapping.length == 2 and @ucd[cp.decomp_mapping[0]].combining_class == 0 and !@ucd.composition_exclusion.include?(cp.code) @@ -125,7 +133,7 @@ module ActiveSupport::Multibyte::Handlers #:nodoc: def dump_to(filename) File.open(filename, 'wb') do |f| - f.write Marshal.dump([@ucd.codepoints, @ucd.composition_exclusion, @ucd.composition_map, @ucd.boundary]) + f.write Marshal.dump([@ucd.codepoints, @ucd.composition_exclusion, @ucd.composition_map, @ucd.boundary, @ucd.cp1252]) end end end |