Question

My database is utf-8. When selecting a text field from a table it looks like this:

postgres=#  select '>'||exp_type||'<', exp_id from t_exp_types where exp_id in (3,11,12,15);
+-----------------------------------------+--------+
|                ?column?                 | exp_id |
+-----------------------------------------+--------+
| >храна<                            |      3 |
| >почивка<                        |     11 |
| >превод<                          |     12 |
| >изравнителен превод< |     15 |
+-----------------------------------------+--------+
(4 rows)

How can I make the columns aligned properly? psql (PostgreSQL) 9.1.3

solution: my locale LC_ALL was set to 'C'. Changing to LC_ALL= fixed the problem

Was it helpful?

Solution

It works fine here:

regress=> WITH t_exp_types(exp_id, exp_type) AS (VALUES (3, 'храна'), (11, 'почивка'), (12, 'превод'), (15, 'изравнителен превод'))
regress-> select '>'||exp_type||'<', exp_id from t_exp_types where exp_id in (3,11,12,15);
       ?column?        | exp_id 
-----------------------+--------
 >храна<               |      3
 >почивка<             |     11
 >превод<              |     12
 >изравнителен превод< |     15
(4 rows)

Fedora 19, Konsole 2.11.2 from KDE 4.11.2. My locale is:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Odd symptoms, though; a simple client_encoding mismatch would mangle the characters, not just the whitespace.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top