It is often the case in a document mapping that a source file can contain special characters that cause problems later down the line - notably in EDI mappings where non-printable characters cannot be allowed.
Arc will treat strings as UTF-8 when reading from files, but sometimes you may want a bit of code to replace the non-printable characters in a string. The following Script:
<arc:set attr="file.file" value="eFilePath]" />
<arc:call op="fileRead" in="file" out="fileo">
<arc:set attr="output.data" value="efileo.file:data | regexreplace('\(^ -~\]','')]" />
</arc:call>
<arc:set attr="output.filename" value="efilename]" />
<arc:push item="output" />
Can be used to replace any characters outside of the printable ASCII range (here, defined as anything not between the whitespace and tilde characters in the ASCII set) with an empty string. This script will replace characters across a whole file, but you can use the regexreplace statement on a single element (such as in the expression editor in an XML Map).