[SlugBug] HTML special chars and databases?

Matthew Gray matt at solis.co.uk
Mon May 16 13:51:16 BST 2005


Hi all,

I've been wondering about this for a little while and wanted to get 
some opinions: When putting text into a database, for later display 
in a webpage, do you:

a) Store the database field with the HTML special chars encoded - 
ie the field had & < > inside it.

or,

b) Store the data with the raw characters, and encode the 
characters to their HTML representations when the record is 
displayed.

I've been thinking about this, and wondering what the advantages / 
disadvantages of each method are. I'm using PHP / MySQL, but I 
guess that this issue occurs with pretty much every other web 
scripting language and database.

Thanks,

Matt

-- 

Matthew Gray

Solis

T: (0114) 258 5550
F: (0114) 258 5574


More information about the SlugBug mailing list