From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: paul.kulakov@systematica.ru
Subject: BUG #18439: No way to see national language error messages when running UTF8 scripts with psql.exe on Windows
Date: Tue, 16 Apr 2024 13:13:42 +0000
Message-ID: <18439-f2f278cf3ffaac11@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18439
Logged by: Pavel Kulakov
Email address: paul.kulakov@systematica.ru
PostgreSQL version: 15.3
Operating system: Windows
Description:
Server has config parameter lc_messages=ru_RU.UTF-8
On Windows with default code page 1251 I run:
chcp 65001
set PGCLIENTENCODING=UTF8
psql --host=localhost --dbname=test --username=test --file=utf8file.sql
The file utf8file.sql is executed OK but if an error occurs psql shows error
message in incorrect encoding.
For example, if utf8file.sql contains string "select 1/0;" I see
psql:utf8file.sql:1: РћРЁРБКА: деление РЅР° ноль
instead of
psql:utf8file.sql:1: ОШИБКА: деление на ноль
======================
Possible solutions:
1) The simplest one is to disable code page translation (CP_ACP ->
ConsoleOutputCP) for stderr (by new psql option?):
_setmode(_fileno(stderr), _O_BINARY);
Of course it will work only if CLIENT_ENCODING corresponds to
ConsoleOutputCP
2) Convert all incoming strings from current CLIENT_ENCODING to active code
page (CP_ACP) before output to console.
======================
Note: at the same time data (tables) output seems all right because of the
magic with pager pipe (indirect output).
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, paul.kulakov@systematica.ru
Subject: Re: BUG #18439: No way to see national language error messages when running UTF8 scripts with psql.exe on Windows
In-Reply-To: <18439-f2f278cf3ffaac11@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox