Re: Bug with PATHs having non-ASCII characters

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: Bug with PATHs having non-ASCII characters
Дата
Msg-id 9837222c1001070226l274aef23h1ff34156cdae4227@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Bug with PATHs having non-ASCII characters  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
Ответы Re: Bug with PATHs having non-ASCII characters
Список pgsql-hackers
On Thu, Jan 7, 2010 at 02:37, Takahiro Itagaki
<itagaki.takahiro@oss.ntt.co.jp> wrote:
>
> Chuck McDevitt <cmcdevitt@greenplum.com> wrote:
>
>> Just an FYI regarding this bug:
>> http://archives.postgresql.org/pgsql-bugs/2009-12/msg00267.php
>>
>> The wide-char version of any WIN32 API call will accept or return
>> data in UTF-16 encoded Unicode, regardless of the local environment's
>> single-byte (MBCS) encoding settings (codepage).
>
> I have a Windows-specific patch for open(), attached for reference.
> But we need to consider about other issues:
>
>  - We need to consider about not only only open(), but also opendir(),
>    stat() and symlink().
>
>  - An entirely-different fix is needed for non-Windows platforms.
>    Probably we will convert encodings from GetDatabaseEncoding() to
>    GetPlatformEncoding() in MBCS, but this is not needed on Windows.
>    We should consider avoiding random ifdef blocks for the switching.

Shouldn't we develop this with "multi-platform" in mind from the
start, instead of doing a Windows specific patch? It may be that we
end up with two completely different codepaths, but more likely we can
share some of it between them?


>  - Those conversions are not free. We might need to avoid conversions
>    for paths under $PGDATA because we only use ascii names in the server.
>    I used a test with IS_HIGHBIT_SET in the attached patch, but I'm not
>    sure whether it is the best method.

If we're going to end up with our own wrapper anyway, we can just pass
an extra parameter to it saying if we want conversion or not? That way
we can avoid doing it for cases where we know it's safe, but do it
when user-input is included?

-- Magnus HaganderMe: http://www.hagander.net/Work: http://www.redpill-linpro.com/


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

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: libpq naming on Win64
Следующее
От: Tim Bunce
Дата:
Сообщение: Re: Testing plperl<->plperlu interaction