Removing invalid/incomplete multibyte characters

前端 未结 2 494
遥遥无期
遥遥无期 2020-12-31 17:40

I\'m having some issues using the following code on user input:

htmlentities($string, ENT_COMPAT, \'UTF-8\');

When an invalid multibyte cha

2条回答
  •  情歌与酒
    2020-12-31 18:22

    iconv('UTF-8', "ISO-8859-1//IGNORE", $string);

    worked extremely well for me. Doesn't seem to generate any notice.

提交回复
热议问题