- 论坛徽章:
- 0
|
show client_encoding
postgres-# ;
client_encoding
-----------------
UTF8
(1 row)
create table t (info char(20));
CREATE TABLE
postgres=# \d t;
Table "public.t"
Column | Type | Modifiers
--------+---------------+-----------
info | character(20) |
postgres=# insert into t values ('这个不曾注意');
ERROR: invalid byte sequence for encoding "UTF8": 0xd5e2
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
postgres=#
\encoding GBK
postgres=# show client_encoding;
client_encoding
-----------------
GBK
(1 row)
postgres=# insert into t values ('这个不曾注意');
INSERT 0 1
postgres=# select * from t;
info
----------------------------
这个不曾注意
(1 row)
\encoding BIG5
postgres=# show client_encoding;
client_encoding
-----------------
BIG5
(1 row)
postgres=# insert into t values ('这个不曾注意');
INSERT 0 1
postgres=# select * from t;
ERROR: character 0xe8bf99 of encoding "UTF8" has no equivalent in "BIG5"
postgres=# |
|