Why is there a small amount of garbled characters?
This post was last edited by u011263669 on 2013-08-20 19:33:32
Our company's website is a zencart e-commerce website
All file formats on the site are utf-8 no BOM encoded format
Run sql: "Set names UTF8" when data is entered in the website
All data tables in the database are in UTF8 format
However, some foreign users in our site registration or editing information, input database will appear garbled, this situation occurs about 5%. Why do garbled characters appear? How to solve?
Share to:
------Solution--------------------
The page encoding of the browser when he browses may not be utf8, or it is a post-translation tour. You can use JavaScript to get the client's code.
------Solution--------------------
Two solutions:
When 1.ajax commits, it is encoded using the +encodeuricomponent method.
The 2.php side can check if the commit is UTF8 encoded.
Check Method http://www.bo56.com/%E4%BD%BF%E7%94%A8%E6%AD%A3%E5%88%99%E6%A3%80%E6%B5%8B%E6%98%AF%E5%90%A6%E4%B8%BAutf8% e7%bc%96%e7%a0%81/