Re: Encoding issues in console and eventlog on win32

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: 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-13 01:13:43
Message-ID: 20091013093313.A6F3.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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.

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

Attachment Content-Type Size
eventlog_20091013.patch application/octet-stream 13.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2009-10-13 01:17:10 Re: [PATCH] Reworks for Access Control facilities (r2350)
Previous Message Tom Lane 2009-10-12 23:45:46 Re: GRANT ON ALL IN schema