Strange character issue between utf-8 and ISO-8859-1 character sets. Need explanation

余生长醉 提交于 2019-12-13 23:19:16

问题


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

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