From: | Daniel Kalchev <daniel(at)digsys(dot)bg> |
---|---|
To: | t-ishii(at)sra(dot)co(dot)jp |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [HACKERS] another locale problem |
Date: | 1999-06-11 08:36:51 |
Message-ID: | 199906110836.LAA24271@dcave.digsys.bg |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>>Tatsuo Ishii said:
[...]
> >From line 5388 of parser/gram.y:
> (strcmp(opname,"~*") == 0 && is
alpha(n->val.val.str[pos])))
>
> I suspect isalpha() does not return true if n->val.val.str[pos] is a
> non ascii char. Probably that's why
[...]
I have tried the following program under BSD/OS 4.0.1:
--- cut here ---
#include <string.h>
#include <locale.h>
#include <rune.h>
#include <errno.h>
main()
{
int i;
printf ("%s\n", setlocale(LC_CTYPE, "CP1251"));
printf ("--- strcoll ---\n");
printf ("%d\n", strcoll("àáâ", "àáã"));
printf ("%d\n", strcoll("àáâ", "àáâ"));
printf ("%d\n", strcoll("àáâ", "àáà"));
printf ("--- isalpha ---\n");
i = 'ë';
printf ("%c, %d\n", i, i);
printf ("%d\n", isalpha('ë'));
printf ("%d\n", isalpha('a'));
}
--- cut here ---
Where the cyrillic letter is the 'L' lowercase in cyrillic, the other are
first characters from the alphabet....
The strcoll work always. This is because BSD/OS does NOT support the
LC_COLLATE and strcoll is effectively strcmp (confirmed by the libc sources).
There are two cases:
1. cc -o test test.c
Returns 0 for isalpha() on cyrillic characers.
2. cc -funsigned-char -o test test.c
Returns 1 for isalpha() on cyrillic characters!
If I substitute the 'ë' character constant with it's code (235), isalpha()
returns 1.
BSD/OS 4.0.1 uses gcc 2.7.2.1. Apparently somewhere in the code 'char' is used
(I did use both --enable-locale and --with-mb=WIN). I am still searching for
it, but the regex code is not very readable... :-(
Daniel
From | Date | Subject | |
---|---|---|---|
Next Message | Tatsuo Ishii | 1999-06-11 08:46:03 | Re: [HACKERS] another locale problem |
Previous Message | Remigiusz Sokolowski | 1999-06-11 08:28:57 | postgres processes |