HTML-encodes a string and returns the encoded string.