I’m having a interface which receives xml files via AS2 and convert it to idoc and post to SAP and also viz verza, i.e. e2 will receive idoc from sap and convert the idoc to xml file with windows-1251 encoding and send it to partner via AS2.
Now the problem is even though partner uses WINDOWS-1251 encoding in xml file, i m not able to see the russian characters when posted to SAP.
Also wen converting the IDoc to xml file i m using stringToBytes with encoding as WINDOWS-1251. But partner says they cannot see the russian characters.
For the case from the partner to SAP, are they specifying the correct encoding in the XML declaration? Hopefully so.
Even if they do that, I’m entirely sure that xmlStringToXMLNode honors the encoding specified in the XML declaration. You may need to explicitly specify the encoding parameter when you make the call.
You’ll need to make sure the SAP integration and perhaps SAP itself is configured to support UTF-8 when passing the translated data to SAP.
For the other direction, you’ll need to explicitly add the XML declaration line yourself. Specify false for the addHeader parameter of documentToXMLString. Create your own XML declaration and then concat it with the resulting XML string from documentToXMLString. Then you can call pub.string:stringToBytes to convert the character set and send those bytes as the payload.
A key approach is to work on one part at a time to make sure each step along the way is doing what you expect.