How to properly handle international character in PHP / MySQL / Apache

后端 未结 5 1851
我在风中等你
我在风中等你 2021-01-03 14:47

I need to create an application in PHP that can handle all Unicode characters in all places — edit fields, static HTML, database. Can somebody tell me the complete list of a

5条回答
  •  隐瞒了意图╮
    2021-01-03 15:26

    I used the mentioned methods and they worked fine. Until recently, when my provider has updated PHP to 5.2.11 and MySQL to 5.0.81-community. After this change the unicode characters were properly retrieved from the database, but all updates were corrupted and unicode characters were being replaced by '?'.

    The solution was to use:

    mysql_set_charset('utf8',$conn);
    

    It was required even though we used:

    SET NAMES utf8
    SET CHARACTER SET utf8
    

    Also - since we have used ADOdb then we needed to find the PHP connection handle. We used the following statement:

    mysql_set_charset('utf8',$adoConn->_connectionID);
    

提交回复
热议问题