Bug 226439. Make nsCharTraits<PRUnichar>::ASCIIToLower handle Unicode characters whose lowercase form is ASCII. r+sr=darin

This commit is contained in:
roc+%cs.cmu.edu 2004-06-16 23:29:49 +00:00
Родитель 9d27b9dbf8
Коммит 8194fc86a7
2 изменённых файлов: 24 добавлений и 2 удалений

Просмотреть файл

@ -36,6 +36,14 @@
#
# ***** END LICENSE BLOCK *****
# If you run this script because the Unicode standard has been updated,
# check xpcom/string/public/nsCharTraits.h to see whether
# nsCharTraits<PRUnichar>::ASCIIToLower needs to be updated. It only
# needs to be update if the Unicode consortium adds (or removes)
# a Unicode character whose lowercase form is an ASCII character.
# Currently there are only two such characters: KELVIN SIGN and
# LATIN CAPITAL LETTER I WITH DOT ABOVE.
######################################################################
#
# Initial global variable

Просмотреть файл

@ -234,13 +234,27 @@ struct nsCharTraits<PRUnichar>
}
/**
* Convert c to its lower-case form, but only if c is ASCII.
* Convert c to its lower-case form, but only if the lower-case form is
* ASCII. Otherwise leave it alone.
*
* There are only two non-ASCII Unicode characters whose lowercase
* equivalents are ASCII: KELVIN SIGN and LATIN CAPITAL LETTER I WITH
* DOT ABOVE. So it's a simple matter to handle those explicitly.
*/
static
char_type
ASCIIToLower( char_type c )
{
return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
if (c < 0x100)
return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c;
else
{
if (c == 0x212A) // KELVIN SIGN
return 'k';
if (c == 0x0130) // LATIN CAPITAL LETTER I WITH DOT ABOVE
return 'i';
return c;
}
}
static