How to prevent weird characters from showing up in web pages

前端 未结 4 1267
天涯浪人
天涯浪人 2021-01-23 07:36

Often when outputting strings from a database onto a webpage, special characters get displayed as some other weird characters (in my example, an em-dash gets tu

4条回答
  •  后悔当初
    2021-01-23 08:11

    You can try this.Use following php inbuilt function to avoid those characters on given string. In your case, data from database.

    html_entity_decode($given_string,ENT_QUOTES, "ISO-8859-1");
    

提交回复
热议问题