我想知道使用 PHP 将字符串转换为 UTF-8 的最佳方法是什么。
以下在页面上看起来不错,但在 MySQL 中,一些字符看起来是乱码。
- MYSQL:
UPGRADE EVENT – New Mazda2 from £124.99 per month. Representative 0% APR over 3 years. Min 50% deposit required. Call xxxxxxxxxxxx for test drive, info or Ts&Cs.
- 在页面上:
UPGRADE EVENT - New Mazda2 from £124.99 per month. Representative 0% APR over 3 years. Min 50% deposit required. Call xxxxxxxxxxxx for test drive, info or Ts&Cs.
我看过 iconv、mb_string、html_entity_decode、htmlentities、mb_convert_encoding 等。
数据库排序规则是 utf8_unicode_ci,表的字符集是 utf8。