Skip to Content
author's profile photo Former Member
Former Member

BSP-XML: Encoding Problem

Hi All,

This question may sound out of forum. But I am having one BSP application which takes XML file as a input and transforms into another XML using a XSLT (using SAP XSLT processor). I have used call transformation method for the same which is working fine (i.e.its transforming correctly).

I noticed that the target system accepts XML file only with encoding 16 and the source file comes with encoding ISO.Is anyone aware of setting encoding in XSLT ? I tried to use but I guess SAP XSLT processor does'nt support that.

Thanks in advance.


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Feb 21, 2005 at 09:37 AM


    the XSLT processor does support xsl:output/@encoding, but refuses to write anything but the system codepage into a STRING. You're able to choose another encoding if you write into an XSTRING.

    Instead of using xsl:output, you may also supply an iXML output stream (IF_IXML_OSTREAM) as the transformation result and set an encoding on the stream.

    Regards - Karsten

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 18, 2005 at 09:41 PM

    I don't know if it would work or not but you could have the XSLT processor render its output into a string data type. You could then use the following code to cast to UTF-16 byte string and add the Byte Order Mark.

      data: lapp_type type char30.
    ****Set the application Type - character set for conversion from string to
    ****Binary String - Excel Requires UTF-16 with Little Endian
     lapp_type = 'text/unicode; charset=utf-16le'.
    ****Convert the string to Binary string (UTF-16le)
      call function 'SCMS_STRING_TO_XSTRING'
          text     = r_string
          mimetype = lapp_type
          buffer   = r_xstring.
    ****Add the UTF-16 Little Endian Byte Order Mark to the begining of the file
      concatenate  cl_abap_char_utilities=>byte_order_mark_little
                   into r_xstring in byte mode.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.