问题
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