Re: [HACKERS] another locale problem

Поиск
Список
Период
Сортировка
От Daniel Kalchev
Тема Re: [HACKERS] another locale problem
Дата
Msg-id 199906110836.LAA24271@dcave.digsys.bg
обсуждение исходный текст
Ответ на Re: [HACKERS] another locale problem  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Ответы Re: [HACKERS] another locale problem  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Список 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.
Probablythat'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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Remigiusz Sokolowski
Дата:
Сообщение: postgres processes
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: Re: [HACKERS] another locale problem