cancel
Showing results for 
Search instead for 
Did you mean: 

SFTP to SFTP FlatFile PassThru Receiver Adapter encoding Issue

former_member194011
Participant
0 Kudos

Hi Sdner's,

Scenario: SFTP to SFTP FlatFile PassThru

Input FlatFile Encoding: UCS-2 LE BOM

Expected output FlatFile Encoding: ANSI

I am using MessageTransformbean and TextCodepageConversionBean in receiver SFTP adapter but file is getting altered. NULL spaces and CRLF were added to file.

PFA ouput file generated.

Please advice if any fix/alternate solution ?

PI Version: 7.5 Single Stack, SP-05, Windows installation, Java Ver- 1.8.0_144

Accepted Solutions (0)

Answers (3)

Answers (3)

ambrish_mishra
Active Contributor
0 Kudos

Hi Kiran,

Try to avoid plan2XML conversion at the sender. Apply UTF-8 encoding on the sender side and do java mapping to arrive at dynamic file name and then covert encoding to ASCII in the receiver.

Hope it works!

Ambrish

former_member194011
Participant
0 Kudos

Hi Raghu,

PFA...Input file.

former_member186851
Active Contributor
0 Kudos

Hello Kiran,

AFAIK its because of encoding to ANSI, when I try in Notepad++ the same is happening.

former_member194011
Participant
0 Kudos

Hi Raghu,

Yes even I feel the same. wondering if any fix for this req or any alternate solution for this ?

former_member186851
Active Contributor
0 Kudos

Hello Kiran,

I am not sure as ANSI might not support this specific characters.

Since the target is also file why there is a specific requirement of converting to ANSI?

former_member194011
Participant
0 Kudos

Hi Raghu,

I think because of some legacy system dependency they need target flat file encoding in ANSI.

Also I've tried below stuff but still no luck 😞

1. SFTP-->SFTP Pass Thru (not working the ANSI file is getting generated but with null spaces and which is not correct file format)

  • Not working ANSI generating with null spaces and which is not correct file format)

2. SFTP(FlatToXML)-->Java Map(Converting XML encoding frm UCS-2 LE BOM to ANSI)-->MM(To Sort out the empty lines)-->SFTP(XMLToFlat)

  • Some special chars are appending to beginning of file due to which messages failing @mapping level, I’ve tried handling special chars in MM but still messages are failing at runtime….but when I try executing the payload in MM test tab it is working fine 😞

Getting below error(This error I am getting after Sender SFTP Adapter converts FlatFile to XML):-

  • BaseRuntimeException: An invalid XML character (Unicode: 0x0) was found in the element content of the document., org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 115; An invalid XML character (Unicode: 0x0) was found in the element content of the document

3. Flow1= SFTP-->NFS(Pass Thru) & Flow2= NFS-->SFTP(Pass Thru).

  • Not working ANSI generating with null spaces and which is not correct file format)

My Observations:-

1. SFTP Sender Adapter is appending special to file chars in Pass Thru/Non-Pass Thru.

2. SFTP Receiver adapter is adding null spaces to target ANSI file generated in Pass Thru/Non-Pass Thru.

3. Even I’ve tried doing SFTP-->SFTP Pass Thru without changing any encoding in PI but still file is getting appended with some special chars.

I feel this is something SFTP Adapter Bug which needs to be raised with SAP ?

former_member186851
Active Contributor
0 Kudos

Can you please share the source file which is in UCS-2 LE BOM format.

when I try this it notepad and convert to ANSI I am getting some other characters

??1�0�1� �8�8�8�8�8�8�8�8�4� �0�0�0�0�0�0�1�4�5�1�7�0�8�0�7�0�9�0�0�1�0�9�4�1�0�1�D�I�N�E�R�S� �T�R�A�C�S� �F�A�S�T� �E�N�T�R�Y�O�P�E�N�T�E�X�T� �
�

former_member194011
Participant
0 Kudos

Hi Raghu,

PFA...Input file