optimized htmlEncode()