开发者

Special characters from CSV to MySQL doesn't work?

开发者 https://www.devze.com 2023-02-03 10:35 出处:网络
I\'m saving out a .csv file from Excel and importing it to a MySQL database (with phpMyAdmin 2.6.4-pl3).

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 w开发者_JAVA技巧orkarounds like I have seen on other posts.

Any ideas on a way to fix this? Thanks.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消