From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Sezai YILMAZ <sezaiy(at)ata(dot)cs(dot)hun(dot)edu(dot)tr> |
Cc: | pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Turkish locale bug |
Date: | 2001-02-20 16:00:09 |
Message-ID: | 12661.982684809@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Sezai YILMAZ <sezaiy(at)ata(dot)cs(dot)hun(dot)edu(dot)tr> writes:
> You are right. What about this one?
> setlocale(LC_ALL, "C");
> for(i = 0; yytext[i]; i++)
> if (isascii((unsigned char)yytext[i]) &&
> isupper(yytext[i]))
> yytext[i] = tolower(yytext[i]);
> /* This sets locale to default locale which
> user prefer to use */
> setlocale(LC_ALL, "");
This isn't really better than "if (isupper(ch)) ch = ch + ('a' - 'A')".
It still breaks the existing locale-aware handling of identifier case,
which I believe is considered a good thing in all locales except C
and Turkish. Another small problem is that setlocale() is moderately
expensive in most implementations, and we don't want to call it twice
for every identifier scanned.
I am starting to think that the only real solution is a special case
for Turkish users. Perhaps use tolower() normally but have a compile-
time option to use a non-locale-aware method:
#ifdef LOCALE_AWARE_IDENTIFIER_FOLDING
if (isupper(yytext[i]))
yytext[i] = tolower(yytext[i]);
#else
/* this assumes ASCII encoding... */
if (yytext[i] >= 'A' && yytext[i] <= 'Z')
yytext[i] += 'a' - 'A';
#endif
and then document that you have to disable
LOCALE_AWARE_IDENTIFIER_FOLDING to use Turkish locale.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Lockhart | 2001-02-20 16:36:19 | Re: Turkish locale bug |
Previous Message | Tom Lane | 2001-02-20 15:36:26 | Re: |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-02-20 16:19:04 | Re: [HACKERS] Re: v7.1b4 bad performance |
Previous Message | Tom Lane | 2001-02-20 15:50:57 | Re: beta5 ... |