From: exclusion@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6510: A simple prompt is displayed using wrong charset
Date: Sat, 03 Mar 2012 18:44:37 +0000
Message-ID: <E1S3twb-0004OY-4g@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 6510
Logged by: Alexander LAW
Email address: exclusion@gmail.com
PostgreSQL version: 9.1.3
Operating system: Windows
Description:
I'm using postgresSQL in Windows with Russian locale and get unreadable
messages when the postgres utilities prompting me for input.
Please look at the screenshot:
http://oi44.tinypic.com/aotje8.jpg
(The psql writes the unreadable message prompting for the password.)
But at the same time the following message (WARINING) displayed right.
I believe it's related to setlocale and the difference between OEM and ANSI
encoding, which we had in Windows with the Russian locale.
The startup code of psql sets locale with the call setlocale(LC_ALL, "") and
MSDN documentation says that the call:
Sets the locale to the default, which is the user-default ANSI code page
obtained from the operating system.
After the call all the strings printed with the printf(stdout) will go
through the ANSI->OEM conversion.
But in the simple_prompt function strings written to con, and such writes go
without conversion.
I've made a little test to illustrate this:
#include "stdafx.h"
#include <locale.h>
int _tmain(int argc, _TCHAR* argv[])
{
printf("ОК\n");
setlocale(0, "");
fprintf(stdout, "ОК\n");
FILE * termin = fopen("con", "w");
fprintf(termin, "ОК\n");
fflush(termin);
return 0;
}
where "ОК" is "OK" with russian letters.
This test gives the following result:
http://oi39.tinypic.com/35jgljs.jpg
The second line is readable, while the others are not.
If it can be helpful to understand the issue, I can perform another tests.
Thanks in advance,
Alexander
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: exclusion@gmail.com
Subject: Re: BUG #6510: A simple prompt is displayed using wrong charset
In-Reply-To: <E1S3twb-0004OY-4g@wrigleys.postgresql.org>
References: <E1S3twb-0004OY-4g@wrigleys.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