update htmlEncode() for wider browser coverage