简体   繁体   中英

Convert utf8 unicode strings to uft8 general ci in PHP not from MySQL

I'd like to ask you how to convert utf8 unicode strings to utf8_general_ci strings in PHP. The reason why I want to do so is because when I import Chinese/Japanese/Russian characters from CSV file in PHP, I can only get strings like ¾G¨Ø®S ...etc. But since I set all collation to utf8_general_ci , I couldn't smoothly save data like ¾G¨Ø®S to database.

Thinking of converting strings to utf8 general ci format, I'm not sure if the Collator Class is able to do so ( http://www.php.net/manual/en/class.collator.php )?

PS. I'm using Cakephp framework. Thanks

使用 php库,并使用utf8_chr_to_unicode_style函数将每个unicode字符转换为代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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