问题
Strange character is shown as � in while my page encoding is in utf-8 but if encoding is ISO-8859-1 than it works fine. I am storing data in mysql database with column encoding utf-8 and connection encoding utf-8. all other characters such as ß
are shown properly and stored same in database.
Can some one explain which character is this and how to remove it?
Thanks.
回答1:
The U+FFFD is a replacement character used to replace an unknown or unprintable character. Basically, this means you are trying to show an unprintable character.
Maybe this will offer some guidance on how to proceed: How to handle user input of invalid UTF-8 characters?
回答2:
Can some one explain which character is this
Since you only showed us the "Unknown character" character instead of the one that worked, that would be tricky.
how to remove it
Don't remove arbitrary data. Pick the character encoding you are using and stick to it. If you are using UTF-8, then use UTF-8 throughout. Don't switch between treating UTF-8 as UTF-8 and treating it as ISO-8859-1, that way lies madness.
来源:https://stackoverflow.com/questions/9314724/strange-character-issue-between-utf-8-and-iso-8859-1-character-sets-need-explan