mysql导出到excel中文乱码

乱码原因:

mysql的编码为utf8,而windows下的excel默认为GB2312

 

 

方法一

导出excel文件为name.xls:

mysql -uroot -p -h"127.0.0.1" -e "select * from tablex where name = 'alen'" >/tmp/name.xls

 

用notepad++打开,并选择编码格式为ANSI,保存,重新用excle打开,大功告成。

 

 

方法二

linux服务器安装iconv工具,转码

iconv -f utf8 -t gb2312 -otype1.xls type.xls

我测试的时候失败了:iconv: illegal input sequence at position 1841

 

posted @ 2020-10-22 15:45  嘿十三  阅读(2244)  评论(0编辑  收藏  举报