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

UNICODE System - XML Encoding Error

Former Member
0 Likes
764

Dear Experts,

We've upgraded our SAP system to ECC 6.0 Unicode. One of our applications works with XML files and we've been experimenting some problems with the XML encoding since the machine is Unicode enabled. In the XML structure we obtain strange chinesse characters:

This should be the right xml response:

<?xml version="1.0" encoding="utf-8"?><OpenHR><employee><id>69900004</id><name>Employee 1, Romania</name><orgName>Test ROMANIA</orgName><role>EMPLOYEE</role><flex>NO</flex><company>NE</company></employee><labels><label id="delegation">Delegations</label>

We obtain:

⸰㰿硭氠癥牳楯渽∱⸰u2220敮捯摩湧㴢畴昭㠢㼾㱏灥湈刾㱥浰汯祥放㱩搾㘹㤰〰〴㰯楤㸼湡浥㹅浰汯祥攠ㄬ⁒潭慮楡㰯湡浥㸼潲李慭放呥獴⁒位䅎䥁㰯潲李慭放㱲潬放䕍偌余䕅㰯牯汥㸼晬數㹎似⽦汥砾㱣潭灡湹㹎䕏㰯捯浰慮社㰯敭灬潹敥㸼污扥汳㸼污扥氠楤㴢摥汥条瑩潮∾䑥汥条瑩潮猼⽬慢敬㸼污扥氠楤㴢桥汰∾䡥汰㰯污扥氾㱬慢敬⁩搽≩湣楤敮捥獔楴汥∾健牳潮湥氠䅤浩湩獴牡瑩潮㰯污扥氾㱬慢敬⁩搽≮潄敬敧慴楯渢㹐汥慳攬⁲整畲渠瑯睮⁣慬敮摡爠楦⁹潵⁷慮琠瑯⁡捣敳猠瑯⁤敬敧慴楯湳㰯污扥氾㱬慢敬⁩搽≮潴敃潮晩牭兵敳瑩潮∾偲敳猠慣捥灴⁩映祯甠獨潵汤⁧整⁩琼

Here is the code where we guess the problem is (we have tried with differente encoding types: ISO-8859-1, UTF-8, UTF-16 and DEFAULT).

DATA: S_ENCODING_TYPE TYPE STRING,

ENCODING TYPE REF TO IF_IXML_ENCODING.

S_ENCODING_TYPE = 'iso-8859-1'.

ENCODING = IXML->CREATE_ENCODING( CHARACTER_SET = S_ENCODING_TYPE

BYTE_ORDER = 0 ).

CALL METHOD ODOCUMENT->SET_ENCODING

EXPORTING ENCODING = ENCODING.

CALL FUNCTION 'SDIXML_DOM_TO_XML'

EXPORTING

DOCUMENT = ODOCUMENT

IMPORTING

SIZE = ISIZERAW

TABLES

XML_AS_TABLE = IDATA

EXCEPTIONS

NO_DOCUMENT = 1

OTHERS = 2.

(IDATA is the variable where we see the chinesse text)

1 REPLY 1
Read only

Former Member
0 Likes
549

It will not give you any effect to set up encoding because this function module sets its own encoding inside:

encoding = pixml->create_encoding( character_set = 'UTF-8' byte_order = 0 ).

Renderer is created by the kernel:

by kernel module abkm_iXML_CreateRenderer.

Something may be wrong with the installation.