for (p = dest; *p; p++)
{
if (locale->is_default)
- *p = pg_tolower((unsigned char) *p);
+ {
+ if (*p >= 'A' && *p <= 'Z')
+ *p += 'a' - 'A';
+ else if (IS_HIGHBIT_SET(*p) && isupper_l(*p, loc))
+ *p = tolower_l((unsigned char) *p, loc);
+ }
else
*p = tolower_l((unsigned char) *p, loc);
}
if (locale->is_default)
{
if (wasalnum)
- *p = pg_tolower((unsigned char) *p);
+ {
+ if (*p >= 'A' && *p <= 'Z')
+ *p += 'a' - 'A';
+ else if (IS_HIGHBIT_SET(*p) && isupper_l(*p, loc))
+ *p = tolower_l((unsigned char) *p, loc);
+ }
else
- *p = pg_toupper((unsigned char) *p);
+ {
+ if (*p >= 'a' && *p <= 'z')
+ *p -= 'a' - 'A';
+ else if (IS_HIGHBIT_SET(*p) && islower_l(*p, loc))
+ *p = toupper_l((unsigned char) *p, loc);
+ }
}
else
{
for (p = dest; *p; p++)
{
if (locale->is_default)
- *p = pg_toupper((unsigned char) *p);
+ {
+ if (*p >= 'a' && *p <= 'z')
+ *p -= 'a' - 'A';
+ else if (IS_HIGHBIT_SET(*p) && islower_l(*p, loc))
+ *p = toupper_l((unsigned char) *p, loc);
+ }
else
*p = toupper_l((unsigned char) *p, loc);
}