From 5e9d33ad49079877ee9461e0449150a28bf0902d Mon Sep 17 00:00:00 2001 From: duerst Date: Fri, 1 Apr 2016 11:58:47 +0000 Subject: * enc/unicode/case-folding.rb, casefold.h: Data generation to implement swapcase functionality for titlecase characters. Swapcase isn't defined by Unicode, because the purpose/usage of swapcase is unclear anyway. The implementation follows a proposal from Nobu, swaping the case of each component of a titlecase character individually. This means that the titlecase characters have to be decomposed. * enc/unicode.c: Code using the above data. * test/ruby/enc/test_case_mapping.rb: Tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enc/unicode/case-folding.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'enc/unicode/case-folding.rb') diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb index 2df430185f..433ce74dfe 100755 --- a/enc/unicode/case-folding.rb +++ b/enc/unicode/case-folding.rb @@ -244,6 +244,15 @@ class CaseMapping unless item.upper == item.title if item.code == item.title flags += '|IT' + swap = case item.code + when '01C5' then '0064 017D' + when '01C8' then '006C 004A' + when '01CB' then '006E 004A' + when '01F2' then '0064 005A' + else # Greek + to.split(' ').first + ' 0399' + end + specials << swap else flags += '|ST' specials << item.title -- cgit v1.2.3