本文介紹了htmlspecialchars(): 參數中的多字節序列無效的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在本地站點中收到此錯誤.
I am getting this error in my local site.
Warning (2): htmlspecialchars(): Invalid multibyte sequence in argument in [/var/www/html/cake/basics.php, line 207]
有誰知道這是什么問題或應該有什么解決方案?
Does anyone knows, what is the problem or what should be the solution for this?
謝謝.
推薦答案
如果您的文件是這樣編碼的,請務必將編碼指定為 UTF-8:
Be sure to specify the encoding to UTF-8 if your files are encoded as such:
htmlspecialchars($str, ENT_COMPAT, 'UTF-8');
htmlspecialchars
的默認字符集是 ISO-8859-1(從 PHP v5.4 開始,默認字符集變成了UTF-8"),這可能解釋了為什么當它出現問題時滿足多字節字符.
The default charset for htmlspecialchars
is ISO-8859-1 (as of PHP v5.4 the default charset was turned to 'UTF-8'), which might explain why things go haywire when it meets multibyte characters.
這篇關于htmlspecialchars(): 參數中的多字節序列無效的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!