HTML Encoder/Decoder

Might want to look at the answers for this stackoverflow question, refactor.