cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while Encoding changes from UTF-16 to UTF-8

Former Member
0 Kudos

Hi Experts,

I am trying to change the xml file encoding from UTF-16 to UTF-8 in my file to file scenario.

The following options i have tried:

1) Using xslt code:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:stylesheet version="1.0" xmlns:ns0="http://www.w3.org/1999/XSL/Transform">

   <ns0:output method="xml" encoding="UTF-8"/>

   <ns0:template match="/">

      <ns0:copy-of select="."/>

   </ns0:template>

</ns0:stylesheet>

This results in error in Interface Determination:

<Trace level="1" type="T">TransfromerException during XSLT processing: Thrown: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Content is not allowed in prolog.

2) Using AnonymizerBean.

Module Name: AF_Modules/XMLAnonymizerBean

Type: Local Enterprise Bean

Module Key: 0

Parameter Name: anonymizer.encoding

Parameter value: UTF-8

This results in error in Interface Determination:

<SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>

  <SAP:P1>com/sap/xi/tf/_MM_SAPFinance_BW_2_Clarity_</SAP:P1>

  <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException:</SAP:P2>

  <SAP:P3>Content is not allowed in prolog.</SAP:P3>

  <SAP:P4 />

  <SAP:AdditionalText />

  <SAP:Stack>Runtime exception occurred during application mapping com/sap/xi/tf/_MM_SAPFinance_BW_2_Clarity_; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Content is not allowed in prolog.</SAP:Stack>

Sender File Channel:

File Type: Binary

Receiver File Channel:

File Type: Text

File Encoding: UTF-8

Please let me know how the encoding changes from UTF-16 to UTF-8 can be done?

There is an error Content is not allowed in prolog. Please let me know what needs to be done.

Thanks,

Sudhansu

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

I wonder if PI is not capable to identify the UTF-16 BOM correctly.

Maybe you check with a hex editor, whether there is a BOM and whether this is correct.

See here:

http://en.wikipedia.org/wiki/Byte_order_mark

What happens if you do not change the encoding, just declare the file type as binary?

former_member184681
Active Contributor
0 Kudos

Hi Sudhansu,

According to SAP Help (here), using Anonymizer Bean is the right way to change the encoding, when working with receiver XML file. Thus, stay with this method.

The "Content is not allowed in prolog" error is discussed in details in one of the blogs by below:

My suggestion would be to use the solution mentioned by Stefan Grube in comments: set the "XI 3.0 compatible" indicator in your service interface.

Regards,

Greg