Should we HTML-encode special characters before storing them in the database?
Solution 1:
Don't HTML-encode your characters before storage. You should store as pure a form of your data as possible. HTML encoding is needed because you are going to display the data on an HTML page, so do the encoding during the processing of the data to create the page. For example, suppose you decide you're also going to send the data in plain text emails. If you've HTML-encoded the data, now the HTML encoding is a barrier that you have to undo.
Choose a canonical form for your data, and store that. UTF-8 is wonderful, and your database supports it (assuming you've created all your tables properly). Just store UTF-8.
Solution 2:
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.
Solution 3:
Do you ever need to search for them? I'm not a MySQL expert but you may have to jump thru hoops to do searches.
Are you concerned about the HTML-ness of the data or the character encoding?
I would say try not to do any special encoding of characters in the DB if you can avoid it. Searching, having to remember special in-bound/out-bound processing, etc.
Solution 4:
If you are doing 100's or 1000's of page presentations for each write, then encoding on the way in is going to be more efficient. But in most circumstances I guess the difference would be negligible.
But the other reasons (to not encode) are good, no doubt about it - and anyway it's pointless to encode characters which UTF-8 likes.