从 CSV 到 MySQL 的特殊字符不起作用?
我正在从 Excel 保存一个 .csv 文件并将其导入到 MySQL 数据库(使用 phpMyAdmin 2.6.4-pl3)。
一些字段有商标符号。但显示为“ª”。我认为这与数据库字段的编码有关,但我更改了它们并发现没有区别。 UTF-8 至少显示小“a”,而我尝试过的其他人只是将其转换为“?”。如果我将其保留为 UTF-8,并在导入 .csv 后手动将“ª”更改为“™”,则效果很好,但由于我有大约 150 个产品,这将需要很长时间。
我认为问题在于 Excel 不会将 .csv 文件导出为 UTF-8,因此字符会丢失。我正在将此信息导出为 PDF,因此我无法像在其他帖子中看到的那样使用任何标准 Web 解决方法。
关于解决这个问题的方法有什么想法吗?谢谢。
I'm saving out a .csv file from Excel and importing it to a MySQL database (with phpMyAdmin 2.6.4-pl3).
A few fields have trademark symbols. but show up as "ª". I thought it was something to do with the encoding of the fields form the database, but I have changed them and found no difference. UTF-8 at least shows the small 'a,' while others I have tried just convert it to a '?'. If I leave it at UTF-8 and manually go in after importing the .csv to change the 'ª' to '™' it works fine, but since I have about 150 products that would take forever.
I think the issue is that Excel does not export the .csv file as UTF-8, so the character gets lost. I am exporting this information to a PDF so I cannot use any standard web workarounds like I have seen on other posts.
Any ideas on a way to fix this? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MySQL 允许为每个数据库指定编码。将数据库的编码更改为有用的编码(例如 UTF-8),或者将输入数据转换为当前的数据库编码。
MySQL allows the specification of the encoding for each database. Either change the database's encoding to something useful, like UTF-8, or convert your input data to the current database encoding.
使用Open Office SpreadSheet将数据导入到sql中,而不是Excel和CSV / txt文件中。
您可以将 Excel 或 CSV 转换为开放式 Office 电子表格并导入 phpMyAdmin
Use Open office SpreadSheet to import data into sql instead of Excel and CSV / txt file.
You can convert Excel or CSV into open office spreadsheet and import in phpMyAdmin