I'm doing a quick and dirty CMS module for a site - just a jWYSIWYG editor.
I've never really thought about the best type to use for the column that will contain the outputted XHTML from the editor. I have a开发者_JS百科lways used blob
in the past, but am unsure why I picked that.
Any recommendations?
Well, since you're storing XHTML data in the database (whether that is acceptable or not is an entirely separate discussion), it's not unreasonable to use a TEXT column instead, since that's all XHTML really is.
Of course, you will want to mind your character encoding.
I would suggest that you just use TEXT. Or if you're concerned about having a large enough space, then you could use LONGTEXT.
TEXT is the safest because you won't be limiting the field size in any way, (however you might want to throw a limit in there anyway) and will probably accept the most exceptions.
精彩评论