Skip to Content
0
Feb 14, 2017 at 05:56 PM

encoding xml file from ISO-8859-1 to utf-8

908 Views Last edit Feb 14, 2017 at 05:59 PM 2 rev

Hello SAP Community,

I've a xml document that appears to have been written with utf-8 but have the encoding 8859-1. (I've changed in the notepad from 8859 to utf-8 and SAP read the file correctly).

Without changing the xml file how can i force the encoding in the abap?

The code seams not to work.

..

data encoding(10) value 'UTF-8'.

* Creating a document
l_document = l_ixml->create_document( ).

* encoding
l_encoding = encoding.
i_encoding = l_ixml->create_encoding( character_set = l_encoding
byte_order = '0' ).
l_document->set_encoding( encoding = i_encoding ).


* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).

the file is opend with

call method cl_gui_frontend_services=>gui_upload
exporting
filename = l_filename
filetype = 'BIN'
importing
filelength = l_xml_table_size
changing
data_tab = l_xml_table
exceptions
others = 19.

What i'm doing wrong?

Thanks. Regards,

Maria João Rocha