error when uploading string with special characters

爱⌒轻易说出口 提交于 2019-12-20 07:45:00

问题


i am uploading a string which has special characters

Example

$what = Fay King suggests ‘Miss Airheart’ as name for ‘Lady Lindy'"

and it uploads as

Fay King suggests ⬠ÜMiss Airheart⬠"! as name for ⬠

What should i do to avoid this decoding error?

I have tried to use utf8_encode on the string, but it did not work out.


回答1:


Please ensure, that the page that uploads the string and the one that displays the string have the same text encoding, e.g. this one:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

In general, each page of your WebApp should have only and only one text encoding set.




回答2:


have you tried a simple urlencode()?

http://php.net/manual/en/function.urlencode.php



来源:https://stackoverflow.com/questions/9384872/error-when-uploading-string-with-special-characters

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