简体   繁体   English

MySQL 工作台表导出UnicodeEncodeError

[英]MySQL Workbench table export UnicodeEncodeError

I am trying to export one of our production tables so I can import it to a local db to experiment with.我正在尝试导出我们的一个生产表,以便我可以将其导入本地数据库进行试验。

But I get this error:但我得到这个错误:

Traceback (most recent call last): File "/Applications/MySQLWorkbench.app/Contents/Resources/libraries/workbench/wizard_progress_page_widget.py", line 197, in thread_work self.func() File "/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_export_wizard.py", line 273, in start_export retval = self.module.start(self.stop) File "/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_import_export_be.py", line 302, in start ret = self.start_export() File "/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_import_export_be.py", line 398, in start_export output.writerow(row) UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 10: ordinal not in range(128)追溯(最近调用最后):文件“/Applications/MySQLWorkbench.app/Contents/Resources/libraries/workbench/wizard_progress_page_widget.py”,第 197 行,在 thread_work self.func() 文件“/Applications/MySQLWorkbench.app/Contents /Resources/plugins/sqlide_power_export_wizard.py”,第 273 行,在 start_export retval = self.module.start(self.stop) 文件“/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_import_export_be.py”,第 302 行,在启动 ret = self.start_export() 文件“/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_import_export_be.py”,第 398 行,在 start_export output.writerow(row) UnicodeEncodeError: 'ascii' 编解码器无法编码position 10 中的字符 '\xf6':序号不在范围内 (128)
ERROR: Export data to file: 'ascii' codec can't encode character '\xf6' in position 10: ordinal not in range(128)错误:将数据导出到文件:“ascii”编解码器无法对 position 中的字符“\xf6”进行编码 10:序号不在范围内 (128)

I am running version 8.0.26 on MacOS.我在 MacOS 上运行 8.0.26 版。

Edit: I used the following options:编辑:我使用了以下选项:

  • File Format: csv文件格式: csv
  • Field Separator: ;字段分隔符: ;
  • Line Separator: LF行分隔符: LF
  • Enclose Strings In: "将字符串包含在: "
  • null and NULL as SQL keyword: YES null 和 NULL 作为 SQL 关键字: YES

I also tried using , as separator but no luck.我也尝试使用,作为分隔符但没有成功。

However, exporting as JSON works!但是,导出为 JSON 有效! It seems slower though:/虽然它似乎更慢:/

如果您在 mac 上使用,请尝试从命令启动 mySql Workbench。

open /Applications/MySQLWorkbench.app

I had the same issue and exporting it to JSON instead of CSV helped.我有同样的问题并将其导出到 JSON 而不是 CSV 帮助。 You can use JSON for importing data just like CSV.您可以像 CSV 一样使用 JSON 导入数据。

I can't comment, but the above answer worked for me:我无法发表评论,但上述答案对我有用:

open /Applications/MySQLWorkbench.app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM