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

后端 未结 6 1980
故里飘歌
故里飘歌 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:42

    Going by the purpose of Database, its not advisable to HTML encode and store the data. Doing so will make the data desirable only for rendering on HTML pages(the one purpose) and for all other operations(many) you need to again decode. This degrades data consistency(since validity, accuracy, usability are hampered) property of Database.

提交回复
热议问题