on 05-21-2014 9:34 AM
Dear SCN,
We have a File to File scenario (NO mapping) which sends CSV file from Source system (Using NFS) to target system (using SFTP). The problem is, the SAP SFTP Add-on Adapter does not have option to specify the file encoding to be used while sending the data. The data file is always sent as UTF-8 format by SFTP adapter however the target system is expecting the file in SHIFT-JIS encoding.
Landscape:
SAP PI 7.11 with SAP SFTP add-on ver 1.0 SP02 (Sys Info gives version as: 1.0002.20140123062343.0000)
Options Tried:
Have also tried options 1 and 2 with Sender File adapter setting : File Type = binary but still SFTP adapter produces UTF-8 file.
NOTE: I did not use XmlAnonymizerBean since our scenario is having CSV file and NOT xml so there is no namespaces etc.
Please let me know how to make the SFTP adapter to use the file encoding required by target system.
Thanks in advance.
Ananth
Dear SCN,
SAP has provided us the work around to resolve the issue of setting file encoding in SFTP Adapter. By default, SFTP adapter does not provide option to set the file encoding however we can achieve this by combining both MessageTransformBean and TextCodepageConversion bean in sequence.
1. SFTP adapter does not support file encoding settings. Is this as per the product design?
Yes, the SFTP adapter works based on the JSch specification which does not support file content encoding. The protocol focus only on transferring the contents as is from one server to another.
2. If yes, is there any work around or solutions we can follow to achieve the target file creation with correct encoding?
[A] Please use the MessagetransformBean to specify content type as SHIFT_JIS and TextCodepageConversionBean to convert it into required encoding.
First you have to set the source encoding of the text file.
Set the Content-Type and Charset of the XI Payload via the MessageTransformBean:
Transform.ContentType = text/plain;charset= UTF-8 (=>the source encoding of the text file)
[B] Then you have to convert the text file into SHIFT_JIS or anyother encoding that you desire via the TextCodepageConversionBean (This bean only works in conjunction with plain text files which you indicate via the Content-Type !) .
Now you set the target encoding for the text file: Conversion.charset = SHIFT_JIS
Regards,
Ananth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please add this reference to your answer - http://scn.sap.com/message/14223332#14223332
Hi Ananth,
While trying to convert a .CSV file from UTF-8 to SHIFT-JIS format, it might have been possible that the length of the data used in data type is small. So while converting variable length exceeding the length in data type might have been an issue. So it might have not been converted to SHIFT-JIS format.
So kindly increase the length of variables in data type to a considerable extent and see if the conversion becomes possible.
Hope this helps you.
Thanks,
Souvik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Souvik,
Since the scenario is File to File without any mapping in PI, we are not using any data types. However the format conversion from UTF-8 to SHIFT-JIS would be done in Adapter level either by using Options in FILE adapter or thru Adapter module bean for SFTP Adapter.
If you know how to set the "File Encoding" paramters for SFTP Adapter, please let me know.
Regards,
Ananth
Dear SCN,
Please let me know how to set file encoding parameter for SAP SFTP Adapter?
Thanks,
Ananth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Ananth,
I am not sure if its a typo error but "Transfer.ContentType = text/plain;charset=SHIFT-JIS " is not appropriate parameter.
It should be "Transform.ContentType = text/plain;charset=SHIFT-JIS".
Hope this helps.
Even we had similar interface and its perfectly fine the the parameters mentioned.
thanks and regards,
Praveen T
Dear Praveen,
Thanks for the reply. Yes, it was a typo error on the post, however I have maintained the parameter correctly in the SFTP channel. But its not working.
Out scenario is File to File without any mapping/conversion. We tried using the MessageTransferBean just for the encoding conversion..
Thanks,
Ananth
hi Ananth,
As per my understanding there is no mapping involved which basically means u are reading file with Japnese character but while reading you are converting it into UTF-8.
I am not sure but might be converting the encoding to SHIFT-JIS to UTF-8 and trying to again convert it back into SHIFT-JIS is causing the problem.
Could you try keeping the same encoding format in the Sender channel also.
hope this helps.
thanks and regards,
Praveen T
Dear Praveen,
The source system is sending the data file in UTF-8 so we are not converting in to SHIFT-JIS in sender side (sender File adapter with Encoding as Text/UTF-8), however when we send the file thru Receiver adapter we want to send it in SHIFT-JIS format converted by Receiver SFTP adapter.
To make this conversion from UTF-8 to SHIFT-JIS there is no option on the SFTP receiver adapter hence we are doing all the workarounds (using modules & additional properties etc) mentioned in my question.
regards,
Ananth
Hi Ananth,
Which JVM is running on your PI machine? Here is a link describing the supported canonical names for Java 6 for instance: http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html
Under the section for the extended sets it gives Shift_JIS or SJIS so I would try the approaches from scenario 1 or 2 using either of those strings instead.
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ryan,
Thanks for the suggestion. Will try and get back on the status.
The encoding type: SHIFT-JIS is working fine on regular file adapter so I believe this is not an issue.
BTW, we are using PI 7.11, this means JRE version is 1.5.
Please see the system information below.
| |||||||||
|
UPDATE:
Have tested with encoding as "SHIFT_JIS" however it did not produce the file in correct format, it is still in UTF-8.
Thanks,
Ananth
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.