How to set charset to UTF-8 in a Zend application?

前端 未结 9 1415
失恋的感觉
失恋的感觉 2021-01-05 14:29

I am developping a Zend application. The data in my database is encoded in \"utf8_unicode_ci\". I declared in my application.ini :

resources.view.encoding =          


        
9条回答
  •  逝去的感伤
    2021-01-05 14:54

    If you need to use utf8_encode() it's meaning that the data in your database is not encoded in UTF8. When you say that your database is encoded in "utf8_unicode_ci" it doesn't actually mean that your data is encoded in UTF8.

    To verify that set encoding is working with Zend Framework by using any of the code you show, it's quite easy. With firefox just right click on the page and click on "View page info" if it's say "Encoding: UTF8" it means that your page is correctly encoded but that your data is not.

    If you was using utf8_decode(), then it would mean that Zend is failing to set the encoding.

提交回复
热议问题