Thread: BUG #18439: No way to see national language error messages when running UTF8 scripts with psql.exe on Windows
BUG #18439: No way to see national language error messages when running UTF8 scripts with psql.exe on Windows
From
PG Bug reporting form
Date:
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).