added encodeURI for attachment