postgresql - 选择西里尔文本(utf-8)时如何对齐列? [英] postgresql - how to align columns when selecting cyrillic text (utf-8)?
本文介绍了postgresql - 选择西里尔文本(utf-8)时如何对齐列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的数据库是 utf-8.从表格中选择文本字段时,它看起来像这样:
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)
如何使列正确对齐?psql (PostgreSQL) 9.1.3
How can I make the columns aligned properly? psql (PostgreSQL) 9.1.3
解决方案:我的语言环境 LC_ALL 设置为C".更改为 LC_ALL= 解决了问题
solution: my locale LC_ALL was set to 'C'. Changing to LC_ALL= fixed the problem
推荐答案
这里工作正常:
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,来自 KDE 4.11.2 的 Konsole 2.11.2.我的语言环境是:
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=
不过,奇怪的症状;一个简单的 client_encoding
不匹配会破坏字符,而不仅仅是空格.
Odd symptoms, though; a simple client_encoding
mismatch would mangle the characters, not just the whitespace.
这篇关于postgresql - 选择西里尔文本(utf-8)时如何对齐列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文