I have a problem with a textfile which is supplied by my customer.
And it sometimes contains some weird characters and I would like to find a way to remove them from the text-file.
I can see the weird characters in Notepad++. It is called VT in the texteditor.
See this screendump:
How's your scripting capabilities? This replaceLineBreak part should get you started, I use it to read a XML and replace the LF with CRLF before I inject it in my SQL database.
VT is probably "Vertical Tab", an ancient character that is used very infrequently. Its ASCII code is 0xB (11). I don't know whether Switch regular expressions support it, but you could try searching for \xb or \x0b. Backslash x means "interpret the next part as a hexadecimal unicode point".
// Is invoked each time a new job arrives in one of the input folders for the flow element.
// The newly arrived job is passed as the second parameter.
function jobArrived( s : Switch, job : Job ){
var extension = s.getPropertyValue("Extension");
var tempFile = job.createPathWithExtension(extension);
var myFile = new File(tempFile);
var InputPath = job.getPath();
var inputFileText = File.read(InputPath);
var outputFileText = inputFileText.replace(/\x0b/g,"");
myFile.open( File.WriteOnly | File.Truncate );
myFile.writeLine(outputFileText);
myFile.close();
job.sendToSingle(tempFile);
job.sendToNull(InputPath);
}
// Is invoked at regular intervals regardless of whether a new job arrived or not.
// The interval can be modified with s.setTimerInterval().
function timerFired( s : Switch )
{
}