Re: Encoding issues in console and eventlog on win32

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Encoding issues in console and eventlog on win32
Date: 2009-10-16 01:23:50
Message-ID: 603c8f070910151823r50d07895x6de31592b360476f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 12, 2009 at 9:13 PM, Itagaki Takahiro
<itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>
> Magnus Hagander <magnus(at)hagander(dot)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.

Magnus has promised me on a stack of instant messages that he will
review this soon, but as he hasn't gotten to it yet, I am moving it to
the next CommitFest.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2009-10-16 01:31:09 Re: Reworks for Access Control facilities (r2363)
Previous Message Robert Haas 2009-10-16 01:22:47 Re: CommitFest 2009-09, two weeks on