0
点赞
收藏
分享

微信扫一扫

postgresql/lightdb ERROR: invalid byte sequence for encoding

zjh@postgres=# show %enc%;
name | setting | description
-------------------------------------------------+---------+----------------------------------------------------------------------------------------
client_encoding | UTF8 | Sets the client's character set encoding.
server_encoding | UTF8 | Sets the server (database) character set encoding.
(2 rows)

zjh@postgres=# select cast('序列'as bytea);
ERROR: invalid byte sequence for encoding "UTF8": 0xd0 0xf2

[zjh@hs-10-20-30-193 ~]$ echo $LANG

en_US.UTF8

[zjh@hs-10-20-30-193 ~]$ locale
LANG=en_US.UTF8
LC_CTYPE="en_US.UTF8"
LC_NUMERIC="en_US.UTF8"
LC_TIME="en_US.UTF8"
LC_COLLATE="en_US.UTF8"
LC_MONETARY="en_US.UTF8"
LC_MESSAGES="en_US.UTF8"
LC_PAPER="en_US.UTF8"
LC_NAME="en_US.UTF8"
LC_ADDRESS="en_US.UTF8"
LC_TELEPHONE="en_US.UTF8"
LC_MEASUREMENT="en_US.UTF8"
LC_IDENTIFICATION="en_US.UTF8"
LC_ALL=

jdbc端没有问题

postgresql/lightdb ERROR:  invalid byte sequence for encoding_javascript

insert into departments(bytetype) values(cast('序列' as bytea));

zjh@postgres=# select bytetype from departments where bytetype is not null;

bytetype

----------------

\xe5ba8fe58897

(1 row)

改用GBK字符集。

[zjh@hs-10-20-30-193 ~]$ export LANG="zh_CN.GBK"

[zjh@hs-10-20-30-193 ~]$ ltsql -p25432

ltsql (13.3-22.1)

Type "help" for help.

zjh@postgres=# select cast('序列'as bytea);

bytea

----------------

\xe5ba8fe58897

(1 row)



如果是ltsql执行sql文件出现编码问题



举报

相关推荐

0 条评论