Page 1 of 1

Invalid Character \0 Null

Posted: Wed Sep 24, 2014 7:47 am
by imfarhan
Dear All
I'm generating the CSV file the column have got Postcode field as a last colum/field.Where the file have No Postcode or have three char of the 1st and 2nd Part of the Postcode like "GU1" 4LM it generate the NUL or escape_char i.e. \0 or NUL at the end of the row as shown below: the invalid char shown on Notpadd++ or TextPad

Code: Select all

 10,123456,19710101,,,,SMITH,,ABC,,1,,,,,,GU1 4LM[color=red]NUL[/color]
 10,123477,19800101,,,, XYZN,,LMN,,1,,,,,,E12 7DJNUL
10,123456,19710101,,,,SMITH,,ABC,,1,,,,,,GU1 4LMNUL
10,123477,19800101,,,, XYZN,,LMN,,1,,,,,,E12 7DJNUL

when I open the generated CSV file it show space or \0 or nul(col=0) character at the end of the row (Can be see on Notepad++ by switch on the CharachterMode on

How can I strip them at the end of the rows I also trying to use SED command on "AFter Job routine" like sed 's/[,\t]*$//'" but not much helpful. Appreciate you help

Is there any function I can use on Transformer?
Kind regards,
Farhan

Posted: Wed Sep 24, 2014 4:22 pm
by ray.wurlod
My guess is that your Postcode field is defined as Char data type and that the value of APT_STRING_PADCHAR in your project is 0x00 (which pads Char fields with NUL characters). Quick fix is to change APT_STRING_PADCHAR to the space character or to 0x20 (equivalent). Otherwise you can explicitly pad the Postcode field in a derivation expression.

Posted: Fri Sep 26, 2014 2:24 am
by imfarhan
Thanks Ray ..
You have spotted the problem. I've found one the Transformer Control in the stream kept the CHAR instead of VARCHAR that's why its was showing \esacpe character \0.

When I change to VARCHAR its fixes the problem.
Many thanks for your support

Have a good weekend
F