If you want to send attachments with special characters in their file names, you will need to make sure that you encode the file name first, e.g., using encodeURI(). Here's an example of a standard outbound Unifi attachment stream script with the correct escaping in place.
(functionprocessStageToRequest(request, stage, transaction, message, bond, scratchpad) {// This information would normally come from the AttachmentSendervar sender =newx_snd_eb.AttachmentSender(transaction, bond);sender.next();var file_name =sender.attachment_name;var mime_type =sender.attachment_type;var attach_id =sender.attachment_id;var reference =bond.getValue('external_reference');//-----------------------// Path construction//-----------------------scratchpad.file_name =encodeURIComponent(file_name);scratchpad.reference =encodeURIComponent(reference);// ?file_name=${scratchpad.file_name}&reference=${scratchpad.reference}//-----------------------// Headers construction//-----------------------// Compose the scratchpad headers and payloadscratchpad.headers = {"Content-Type": mime_type };//-----------------------// Payload construction//-----------------------// This is the string that triggers attachment streaming outbound payload ='sys_attachment:'+ attach_id;})(request, stage, transaction, message, bond, scratchpad);