I’m running into an error using unicode delimiters with the ‘addGroupEnvelope’ service. My flow is similar to the example given in the ‘processXMLSource’ flow of the ‘WmEDISamples’ package in that I initialize the ‘delimiters’ record in a map step then call ‘convertToString’ and ‘addGroupEnvelope’. My field seperator is ‘\u002f’ and my segment terminator is ‘\u0015’. The delimiters work correctly in the ‘convertToString’ service, but the ‘addGroupEnvelope’ service reads the values as literals and creates the GS and GE segments with ‘GS\u002f’ rather than ‘GS/’.
I ran into this too. These types of inconsistencies can be really quite maddening. The trick is to convert the values yourself. Here is a Java service I use to do this. Call it and assign the output to the desired delimiter field. Hope this helps.
– Converts Java and Unicode character escape literals to their character equivalent.
– Various services may require the use of special characters that cannot normally be typed at the keyboard, such as a newline or carriage return. These characters can be supported through the use of escape sequences. These escape sequences are interpreted and converted to their character equivalent.
– The following escaped characters can be specified as the input variable and will be converted as described:
\b - Backspace
\t - Horizontal tab
\n - Newline
\f - Form feed
\r - Carriage return
\uXXXX - The Unicode character with encoding XXXX, where XXXX is four hexadecimal digits. For example, \u000a represents a newline character.
If the input variable unitCode contains any other values, the first character is returned. If unitCode is null or empty, the returned character is 0 (nul - not the character ‘0’).
unitCode - The string to be converted. The input string should contain only a single character or one of the above escape sequences.
char - A single character that represents the escape sequence specified in unitCode. If unitCode is not one of the above sequences, the first character in unitCode is returned. If unitCode is null or empty, a binary 0 is returned.
String unitCode = null;
char theChar = 0;
IDataHashCursor pipelineCursor = pipeline.getHashCursor();
if ( pipelineCursor.first( “unitCode” ) )
unitCode = (String) pipelineCursor.getValue();
if(unitCode != null)
unitCode = unitCode.trim();
if(unitCode.length() > 0)
theChar = unitCode.charAt(0); // default to return 1st character
if(unitCode.charAt(0) == ‘\’)
if(unitCode.length() == 1)
theChar = ‘\’;
else if(unitCode.length() == 2)
theChar = ‘\r’;
theChar = ‘\n’;
theChar = ‘\b’;
theChar = ‘\t’;
theChar = ‘\f’;
else if((unitCode.charAt(1) == ‘u’) && (unitCode.length() >= 6))
theChar = (char) Integer.parseInt(unitCode.substring(2, 6), 16);
IDataHashCursor pipelineCursor_1 = pipeline.getHashCursor();
The imports can be ignored. They are there for other services with the package that I have this service in.
Looks like I didn’t escape a couple of the literals enough to make them appear properly in the forum. Here are the right literals (they will look funky in e-mail–they look right in the wMUsers forum):
if(unitCode.charAt(0) == ‘\’) // was ‘’
if(unitCode.length() == 1)
theChar = ‘\’; // was ‘’
Sorry for any confusion!