Cannot store UTF8 characters in MySQL

前端 未结 6 1187
抹茶落季
抹茶落季 2021-01-06 14:38

Cannot find the reason why I am unable to store in a MySQL database characters like ţ, î, ş.

My table definition is:

CREATE TABLE IF NOT EXISTS `gen_         


        
6条回答
  •  盖世英雄少女心
    2021-01-06 15:10

    If this:

    $text = 'ţ, î, ş';
    

    is your literal code, you need to make sure that the PHP source file is encoded as UTF-8 as well. Otherwise, these characters will be ISO-8859-1 characters in a Unicode context, resulting in broken characters.

提交回复
热议问题