php encoding issue htmlentities

后端 未结 2 1094
梦如初夏
梦如初夏 2021-01-07 14:14

I have user input and use htmlentities() to convert all entities. However, there seems to be some bug. When I type in

ääää öööö üüüü ääää

I

2条回答
  •  一生所求
    2021-01-07 14:41

    it is important that 3th parameter of htmlentities matches the character set that uses the post. I supouse, you are NOT submiting utf8, as it is the default in htmlentities

    in PHP

     $post = htmlentities ( $post, ENT_COMPAT, 'ISO-8859-1')  // or whatever  
    

    in Form

     

    anyway, actualy I recommend you to use utf8

提交回复
热议问题