02-14-2017 5:56 PM
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
02-14-2017 6:09 PM
I guess the only solution is to modify the xml in memory, between GUI_UPLOAD and PARSE.
Of course, the best solution is to ask for a correct XML file!
02-15-2017 9:53 AM
Yes the best solution would be the correct xml, but I'm afraid that is not possible...
I wish create_encodingworked on the abap code!
Thanks.
Maria João Rocha