Reputation: 12512
I need to store a snippet of HTML/PHP code in my table. I am using BLOB, but am not sure what is best to use, ASCII or UTF-8. What's the difference? Or shall I use TEXT altogether?
Upvotes: 0
Views: 112
Reputation: 7155
TEXT
is better to use when you're going to use some sort of search function of that field (FULLTEXT).
BLOB
is better for storing data like HTML pages and storing data that will not be searched (FULLTEXT, LIKE), but just loaded.
Upvotes: 0
Reputation: 7905
BLOB is to varbinary as TEXT is to varchar.
Essentially store binary data in BLOBs and store text in TEXT. If you are storing the actual html code then use TEXT if you are storing the html files then use BLOB.
If you need to be able to perfrom things like ORDER BY or LIKE, you can not use BLOB.
Upvotes: 1
Reputation: 382274
You should use TEXT and set your whole set of tools to use UTF-8 only : your base, this column, but also HTML/PHP files (check your text editor and the headers), connections, and so on.
Today, except when you have to connect to specific (and old) databases, using UTF-8 everywhere is almost the sole sane choice.
Read this : http://www.utf8everywhere.org/
Upvotes: 4