Teodor Sigaev wrote:
>> I think that Mr. Inoue's patch is right.
>> why isn't it taken into consideration yet?
>
> I can't check that patch because I don't have a Windows box.
> But I did some investigations. As I understand, the patch prevents from
> calling of wcstombs/mbstowcs with C locale and I checked trace for that.
> But wcstombs/mbstowcs doesn't called at all with C-locale. With C
> locale char2wchar calls pg_mb2wchar_with_len(),
pg_mb2wchar_with_len() converts server encoded strings to pg_wchar
strings. But pg_wchar is typedef'd as unsigned int which is not the
same as wchar_t at least on Windows (unsigned short).
If pg_mb2wchar_with_len() works for wchar_t on Windows, we had better call it in all cases on Windows to implement
char2wchar().
> and char2wchar is called from single place: TParserInit.
> wchar2char isn't called at all.
I modified it corresponding to the change in char2wchar() so that
wchar2char(char2wchar(x)) becomes x. Though I'm not sure if it is
called or not, isn't it an principle?
If there's an effective function like pg_wchar2mb_with_len() which
converts wchar_t strings to server encoded strings, we had better
simply call it for char2wchar().
regards,
Hiroshi Inoue