TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

Inserting Chinese characters with Python

Open cddonald opened this issue 6 years ago • 4 comments

Server 版本 2.0.3 在windos客户端 命令行直接插入中文数据,无论是用Python读取还是客户端直接读取,显示乱码, 使用python插入,并使用python 读取数据,编码正常。 但是使用python 插入数据,使用客户端读取,编码还是错误。 请问是需要做什么配置么?

cddonald avatar Sep 16 '20 11:09 cddonald

try set properties when you establishing a connection

conn = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/etc/taos",charset="UTF-8",locale="en_US.UTF-8",timezone="UTC-8")

and checkout the character of your server. you can use the command

cat /var/log/taos/taosdlog.0 | grep charset

and checkout your field type, use NCHAR to store chinese string.

zyyang90 avatar Sep 17 '20 02:09 zyyang90

```shell
cat /var/log/taos/taosdlog.0 | grep charset

我的python怎么设不设置properties都是对的,现在的问题是windos客户端上显示的都是乱码,是否需要对客户端进行配置?

cddonald avatar Sep 17 '20 05:09 cddonald

如果要存储中文字符,请使用nchar字段。

zyyang90 avatar Sep 22 '20 05:09 zyyang90

This issue is stale because it has been open for 30 days with no activity.

zyyang90 avatar Apr 18 '22 05:04 zyyang90