How to make MySQL handle UTF-8 properly

前端 未结 14 2546
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 06:38

One of the responses to a question I asked yesterday suggested that I should make sure my database can handle UTF-8 characters correctly. How I can do this with MySQL?

14条回答
  •  感情败类
    2020-11-22 07:22

    Set your database connection to UTF8:

      if($handle = @mysql_connect(DB_HOST, DB_USER, DB_PASS)){          
             //set to utf8 encoding
             mysql_set_charset('utf8',$handle);
      }
    

提交回复
热议问题