TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

when use taosdump , the Chinese character will be transferred to \xxx format

Open IZ-ONE opened this issue 5 years ago • 4 comments

使用taosdump进行表数据导出,表结构如下 QQ图片20210706163540 其中box_name、plc_name等字段会存放中文,但是使用的数据类型时binary;在进行导出时,导出的insert语句中中文值会被转义成\xxx 形式,如下所示 INSERT INTO data.xksc_real_2d6f0214c94c4dc9880ab487ae9be390_68 VALUES (1609382395197, '\xe5\x85\xb3\xe7\x94\xb0\xe8\x87\xaa\xe6\x9d\xa 5\xe6\xb0\xb4\xe5\x8e\x82', '2', '\xe9\x80\x81\xe6\xb0\xb4\xe6\xb3\xb5\xe6\x88\xbf', '\xe6\xb8\x85\xe6\xb0\xb4\xe6\xb1\xa0\xe6\xb6\xb2 \xe4\xbd\x8d\xe6\x8a\xa5\xe8\xad\xa6\xe4\xb8\x8b\xe9\x99\x90', '1', 0.600000) ; 实际存放的数据 1

在进行sql导入/恢复时,该转义字符会当成字符串恢复到目标数据库,并不会反转义成中文恢复;有别的方法可以转移数据时解决中文导入导出问题么?

IZ-ONE avatar Jul 06 '21 08:07 IZ-ONE

可以试一下在线同步工具,两个库之间同步 https://github.com/PascalMing/PascalTaosDbSyncV2

PascalMing avatar Jul 06 '21 12:07 PascalMing

中文数据是要用nchar保存的,咱们是什么版本?

yu285 avatar Jul 07 '21 02:07 yu285

最早版本好像是2.0.3中创建的表(使用了binary),其中陆续升级了两次版本,分别是2.0.5 、2.0.15,在升级2.0.5进行数据备份及恢复时候使用taosdump是没这个问题,中文可以正常备份及恢复

------------------ 原始邮件 ------------------ 发件人: "taosdata/TDengine" @.>; 发送时间: 2021年7月7日(星期三) 上午10:01 @.>; 抄送: "Tragedy of @.@.>; 主题: Re: [taosdata/TDengine] 使用taosdump命令导出表数据,包含中文字段时会进行转义 (#6758)

中文数据是要用nchar保存的,咱们是什么版本?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

IZ-ONE avatar Jul 07 '21 02:07 IZ-ONE

现在的中文要用nchar处理了,也希望可以尽快升级到最新的2.1.3.2,旧版本已经不好支持了。

yu285 avatar Jul 11 '21 09:07 yu285