Updated code for html encode and decode.