on 10-03-2013 10:40 AM
Hi Team,
we are working on webservice to RFC.
Where webservice side dealers enter a data in to English and thai.When they enter in eglish request coming to CRM and CRM giving response back. everything looks fine.
When dealer enters in thai charecters,here we are facing the problem.
webservice sending thai charecters to CRM thought sap xi.I can see thai charecters in SAP CRM.in turn CRM giving resonse back to CRM there also i can able to see te thai text.After convertion Xi is converting that thai data in to "??????????".
Inbound message coming from CRM :
<CUST_TITLE>คุณ</CUST_TITLE>
<FLEET_CODE>******</FLEET_CODE>
<FLT_APPR_CODE />
<SEX>2</SEX>
<FNAME>อรรถวิทย์</FNAME>
<LNAME>ศฤงฆานนท์</LNAME>
<CNAME1>******</CNAME1>
After pipeline steps in moni below i sthe output message:
<soapenv:Header />
- <soapenv:Body>
- <ns1:ConsumerRetrieveResponse OperationStatus="succeeded">
- <ns2:Consumer ns2:ReadOnly="false" ConsumerType="Person" ConsumerID="0001212044">
- <ns2:ConsumerName>
- <ns6:PersonName>
<ns6:NameElement ns6:ElementType="FirstName">?????????</ns6:NameElement>
<ns6:NameElement ns6:ElementType="LastName">?????????</ns6:NameElement>
<ns6:NameElement ns6:ElementType="Title">???</ns6:NameElement>
</ns6:PersonName>
</ns2:ConsumerName>
- <ns5:Addresses>
here we are using java mapping to convert saop req to xml and xml to soap response.Attaching java mappings below.
Please suggest me where is the problem.
Regards,
Narendra
This is the cause of your issue:
public String inputStreamToString(InputStream in) { |
int c = 0; | ||||
while ((c = isr.read()) != -1) { | ||||
buf.append((char) c); |
This code does not make any sense for a code page which is not single byte.
Note: A UTF-8 character could have one to four bytes.
When there is for example a letter which has two bytes, ten your code creates two different letters from one. That creates your "?" in the output.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use TIS encoding in output file..
Check these threads
Special Character being replaced by Question Marks in Java Mapping
Output encoding in Java mapping ?
http://scn.sap.com/docs/DOC-16138
Regards
Rodrigo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This document might be helpful:
How To Work with Character Encodings in Process Integration
Liz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Narendra,
Do byte transformations first before manipulating payloads of a different encoding. A sample code for converting ISO-8859-1 to UTF-8:
Where sourceXML is a String
byte[] latin1 = sourceXML.getBytes("ISO-8859-1");
byte[] utf8 = new String(latin1, "ISO-8859-1").getBytes("UTF-8");
String xml = new String(utf8, "UTF-8");
xml = xml.replaceAll("ISO-8859-1", "UTF-8");
The last line is for replacing the entry for the prolog.
In your case, convert ISO-8859-11 to UTF-8.
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark,
Thanks for your quick response.
Here SaopToXml.java is using to convert ISO-8859-1 to UTF-8.that is working fine.
Xi is handling request message properly.in the response message we are using 2 java codes which i have uploaded above.XMLTOSOAP .java and xml formatter.java. i guess here we are facing some problem.
But i could not able to identify the problem.
Could you please suggest.
Regards,
Narendra
Hello Narendra,
ISO-8859-1 is Latin 1, you should use ISO-8859-11
http://en.wikipedia.org/wiki/ISO_8859
Hope this helps,
Mark
Hello Narendra,
ISO-8859-1 is Latin 1, you should use ISO-8859-11
http://en.wikipedia.org/wiki/ISO_8859
Hope this helps,
Mark
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.