Should we HTML-encode special characters before storing them in the database?

后端 未结 6 1979
故里飘歌
故里飘歌 2020-12-03 13:36

I use MySQL to store data and my web pages are all encoded as UTF-8. I have a lot of Portuguese characters such as ç and õ and I\'m wondering if I

6条回答
  •  臣服心动
    2020-12-03 13:58

    I wouldn't encode it in the database unless there's a clear and definite value to doing that. You (and anyone else who will ever work with the data) will have to remember to un-escape when using that data or escape whatever data you insert, update, or compare to that field. I'm not sure what the benefit is to escaping it, but it's probably not worth it.

提交回复
热议问题