On Wednesday, 3 October 2012 at 10:56:11 UTC, Minas wrote:
Currently, toUpper() (and probably toLower()) does not handle greek characters correctly. I fixed toUpper() by making a another function for greek characters

// called if (c >= 0x387 && c <= 0x3CE)
dchar toUpperGreek(dchar c)
{
        if( c >= 'α' && c <= 'ω' )
        {
                if( c == 'ς' )
                        c = 'Σ';
                else
                        c -= 32;
        }
        else
        {
                dchar[dchar] map;
                map['ά'] = 'Ά';
                map['έ'] = 'Έ';
                map['ή'] = 'Ή';
                map['ί'] = 'Ί';
                map['ϊ'] = 'Ϊ';
                map['ΐ'] = 'Ϊ';
                map['ό'] = 'Ό';
                map['ύ'] = 'Ύ';
                map['ϋ'] = 'Ϋ';
                map['ΰ'] = 'Ϋ';
                map['ώ'] = 'Ώ';
                
                c = map[c];
        }
        
        return c;
}

Then, in toUpper()
{
   ....
   if (c >= 0x387 && c <= 0x3CE)
      c = toUpperGreek()...
   ///
}

Do you think it should stay like that or I should copy-paste it in the body of toUpper()?

I'm going to fix toLower() as well and make a pull request.

Regarding toLower() a problem I see is how to handle sigma (Σ), because it has two possible lower case representations depending where it occurs in a word. But of course toLower() is working on character basis, so it cannot know what the receiver plans to do with the character.

--
Paulo

Reply via email to