Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Converting UTF-16 to UTF-8

Former Member
0 Likes
3,078

Hi all,

I have XML data in UTF-16 format in 'xml_result' using the below command. I need the data in UTF-8 format to download. How should i convert it?

*CALL TRANSFORMATION id

  • SOURCE H_EXP = IGR

  • RESULT XML xml_result.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,741

Call the FM like below....

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'

EXPORTING

IM_XSTRING = x

IM_ENCODING = 'UTF-8'

IMPORTING

EX_STRING = x.

Reward pointss.

Hi all,

I have XML data in UTF-16 format in 'xml_result' using the below command. I need the data in UTF-8 format to download. How should i convert it?

*CALL TRANSFORMATION id

  • SOURCE H_EXP = IGR

  • RESULT XML xml_result.

Thanks

4 REPLIES 4
Read only

Former Member
0 Likes
1,742

Call the FM like below....

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'

EXPORTING

IM_XSTRING = x

IM_ENCODING = 'UTF-8'

IMPORTING

EX_STRING = x.

Reward pointss.

Read only

0 Likes
1,741

Hi Murali,

My output 'xml_result' is already of type STRING. Do you know any other function module for which we can give a string input?

Thanks

Read only

0 Likes
1,741

Call transformation id xml xstring, then use the ECATT_CONV_XSTRING_TO_STRING to covert it.

Read only

0 Likes
1,741

Pl refer the below code snippet,

DATA: xml_stream TYPE REF TO if_ixml_istream,
            xml_factory  TYPE REF TO if_ixml_stream_factory.

xml_stream = xml_factory->create_istream_string( string = xml_data ).