Re: Encoding issues in console and eventlog on win32

Поиск
Список
Период
Сортировка
От Itagaki Takahiro
Тема Re: Encoding issues in console and eventlog on win32
Дата
Msg-id 20091013093313.A6F3.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Re: Encoding issues in console and eventlog on win32  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: Encoding issues in console and eventlog on win32  (Robert Haas <robertmhaas@gmail.com>)
Re: Encoding issues in console and eventlog on win32  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
Magnus Hagander <magnus@hagander.net> wrote:

> One other question - you note that WriteConsoleW() "could fail if
> stderr is redirected". Are you saying that it will always fail when
> stderr is redirected, or only sometimes? If ony sometimes, do you know
> under which conditions it happens?

It will always fail if redirected. We can test the conditions using:
    pg_ctl start > result.log
So, the comment should be:
    /* WriteConsoleW always fails if stderr is redirected. */

I cleaned up the patch per comments. I hope this will be the final one ;-).

  * Use in_error_recursion_trouble() instead of own implementation.
  * Use def_enc2name() macro to avoid adding the codepage field
    on non-win32 platforms.
  * Fix a bug of calculation of result length.
  * Fix a memory leak on error handling path in pgwin32_toUTF16().


> If it's always, I assume this just means that the logfile will be in
> the database encoding and not in UTF16? Is this what we want, or would
> we like the logfile to also be in UTF16? If we can convert it to
> UTF16, that would fix the case when you have different databases in
> different encodings, wouldn't it? (Even if your editor, unlike the
> console subsystem, can view the individual encoding you need, I bet it
> can't deal with multiple encodings in the same file)

Sure, the logfile will be filled with mixed encoding strings,
that could happen in logfile and syslog on non-win32 platforms.
I think UTF8 is better than UTF16 for logfile encoding because
there are some text editors that do not support wide characters.
At any rate, the logfile encoding feature will come from another patch,
that might add "log_encoding" variable and work on any platforms.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Вложения

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

Предыдущее
От: Tim Landscheidt
Дата:
Сообщение: Feature Request: "generate_series(DATE, DATE)" and "generate_series(DATE, DATE, INT)"
Следующее
От: KaiGai Kohei
Дата:
Сообщение: Re: [PATCH] Largeobject access controls