Project

General

Profile

« Previous | Next » 

Revision 3628eae2

Added by duerst (Martin Dürst) over 5 years ago

implement special behavior for Georgian for String#capitalize

The modern Georgian script is special in that it has an 'uppercase'
variant called MTAVRULI which can be used for emphasis of whole words,
for screamy headlines, and so on. However, in contrast to all other
bicameral scripts, there is no usage of capitalizing the first letter
in a word or a sentence. Words with mixed capitalization are not used
at all.

We therefore implement special behavior for String#capitalize. Formally,
we define String#capitalize as first applying String#downcase for the
whole string, then using titlecase on the first letter. Because Georgian
defines titlecase as the identity function both for MTAVRULI ('uppercase')
and Mkhedruli (lowercase), this results in String#capitalize being
equivalent to String#downcase for Georgian. This avoids undesirable
mixed case.

  • enc/unicode.c: Actual implementation

  • string.c: Add mention of this special case for documentation

  • test/ruby/enc/test_case_mapping.rb: Add two tests, a general one
    that uses String#capitalize on some (including nonsensical)
    combinations of MTAVRULI and Mkhedruli, and a canary test to
    detect the potential assignment of characters to the currently
    open slots (holes) at U+1CBB and U+1CBC.

  • test/ruby/enc/test_case_comprehensive.rb: Tweak generation of
    expectation data.

Together with r65933, this closes issue #14839.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e