how to insert special character in mysql via php and display on html page

后端 未结 4 1190
半阙折子戏
半阙折子戏 2020-12-17 06:17

how to insert special characters into a database(MySQL) like

Registered symbol ( ® ) OR Copyright sign ( © ) OR Trade Mark sign ( ™ )<

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 06:51

    For starters, you should just use mysql_real_escape_string when inserting into the database - this will ensure that whatever you store is safely encoded, yet retains all of the original information.

    In terms of output, the key difference between htmlentities and htmlspecialchars is that htmlentities will convert all characters that have entities whereas htmlspecialchars will only convert <, >, &, ", '

提交回复
热议问题