Different charset on different server?

回眸只為那壹抹淺笑 提交于 2019-11-29 15:57:46

Which charset is your file written in?

Since you have written the characters you would like to replace directly into your code, as strings, they are encoded in whatever charset the file uses. If that charset differs from what you get from the browser, your functions aren't going to work.

The important point you need to keep in mind, is to always keep track of the charset your strings are encoded with, and convert when neccessary.

Take a look at Kore Nordmanns FAQ about charsets in PHP for some more pointers about charsets.

I recommend you rely on existing, highly-tested code to do this. I believe all these functions assume UTF-8 input and output 7-bit ASCII:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!