Re: 7.4.1 release status - Turkish Locale - Mailing list pgsql-hackers

From Nicolai Tufar
Subject Re: 7.4.1 release status - Turkish Locale
Date
Msg-id 001801c3e899$294b8000$7a00a8c0@ntufar
Whole thread Raw
In response to Re: 7.4.1 release status - Turkish Locale  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: 7.4.1 release status - Turkish Locale  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> I still don't much like having a locale-specific wart in the parser
> (and the code you give could not work anyway --- for starters, the
> first argument of setlocale is not a pointer).

Aw, I see, my code broken. I got confused by locale_......_asign()
family
if functions. Sure, first argument need to be int. But as you said the
code
is a wart.

> A possible compromise is to apply ASCII downcasing (same as in
> keywords.c) for 7-bit-ASCII characters, and apply tolower() only
> for character codes above 127.  In other words
>
>     unsigned char ch = (unsigned char) ident[i];
> 
>    if (ch >= 'A' && ch <= 'Z')
>        ch += 'a' - 'A';
>    else if (ch > 127 && isupper(ch))
>        ch = tolower(ch);
>    ident[i] = (char) ch;
>
> In reasonably sane locales this will have the same effects as
currently,
> while in unsane locales it will ensure that basic-ASCII identifiers
are
> treated the way we want.

If we go this way why not make a special case only and only for 'I'
Character and not all 7-bit ASCII:
unsigned char ch = (unsigned char) ident[i];
if(ch == (unsigned char)'I')    ch = 'i';else    ch = tolower(ch)ident[i] = (char) ch;    

Will it break any locales?

>
>            regards, tom lane

Regards
Nicolai




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Make length(char(n)) return 'true' length
Next
From: Tom Lane
Date:
Subject: Re: 7.4.1 release status - Turkish Locale