search

Home  >  Q&A  >  body text

mysql - php output garbled characters

The display in phpmyadmin is normal, but the output to the web page displays garbled characters. (This problem only occurred after I deployed it to the server) All Chinese characters turned into question marks, but everything in my local code was normal.

伊谢尔伦伊谢尔伦2775 days ago699

reply all(2)I'll reply

  • 欧阳克

    欧阳克2017-06-16 09:20:25

    1. Set database connection string encoding utf8

    2. Set the character encoding at database level, table level and field level to utf8_general_ci. If not set, the default is latin1_swedish_ci (gbk is supported, utf-8 encoding will cause garbled characters)

    Beginners usually make the second mistake, because I did it too,

    reply
    0
  • 習慣沉默

    習慣沉默2017-06-16 09:20:25

    Encoding problems and compiler problems can also occur. Some default storage is not utf-8

    reply
    0
  • Cancelreply