Thursday, June 25, 2009

Turn on English locale in psql PostgreSql client

Problem with encoding (unicode PSQL and cp1251 terminal)

That's kinda strange.
When you run the psql - PostgreSQL RDBMS console client - it picks up your current language (the one set up in your system). That's really cool, but it works in unicode, and if your terminal is not unicode (for example, cmd.exe on windows), you'll see something weird.
That's the example. (take a look at weird symbols after the 'count' results. I really think this is analog of 'row' in Russian)
The easiest solution of psql/terminal encoding problem you'd think of ever
Just type in
set LC_MESSAGES=en
in windows, or
export LC_MESSAGES=en
in UNIX, and you'll get it working. The cool thing is that it is written in psql documentation, but kinda not-that-easily-found. :)

Enjoy!

No comments: