Hi there,
Here I'd like to report an issue encountered during my use of PG18.
Description:
Chinese translations exist in the .mo file but are not being used at runtime for error messages on PostgreSQL 18 Windows.
Environment:
- PostgreSQL version: 18.0
- OS: Windows 10 x64 (Build 17763)
- Installation: EnterpriseDB installer (postgresql-18.0-1-windows-x64.exe)
- Locale: zh_CN (Chinese Simplified)
- Database encoding: UTF8
Steps to reproduce:
1. Install PostgreSQL 18 on Windows
2. Set environment: LANG=zh_CN, chcp 936
3. Run psql and execute: INSERT INTO tb (c) VALUES ('a\O\0');
Expected output (based on .mo file translations):
错误: 无效的 "UTF8" 编码的字节顺序: 0x00
Actual output:
WARNING: nonstandard use of escape in a string literal
第1行INSERT INTO tb (c) VALUES ('a\O\0');
^
提示: Use the escape string syntax for escapes, e.g., E'\r\n'.
ERROR: invalid byte sequence for encoding "UTF8": 0x00
Observations:
- Some parts ARE translated: "第1行" (line 1), "提示" (HINT)
- Main messages are NOT translated: "WARNING", "ERROR", error text
- The .mo file at C:\Program Files\PostgreSQL\18\share\locale\zh_CN\LC_MESSAGES\postgres-18.mo contains 5214 translations including:
- "ERROR" → "错误"
- "WARNING" → "警告"
- "nonstandard use of escape in a string literal" → "字符串常量中以非标准的方法使用转义字符"
- "invalid byte sequence for encoding \"%s\": %s" → "无效的 \"%s\" 编码的字节顺序: %s"
Translation file verified:
The translations exist in the .mo file but are not being applied at runtime.
Possible cause:
This appears to be a bug in PostgreSQL 18's gettext internationalization on Windows, where some message types are not being correctly localized.
---
Please let me know if you need any additional information.
Thanks and Best Regards!
Elodie Fu
| elodie beifu23@foxmail.com |