Issue with CL_ABAP_CONV_X2X_CE (could not handle Strange characters)
I have a requirement to send Chinese data from SAP tables including Strange characts(%$#@* etc.,) from Non-unicode system ecc5.0(with English log on) to External system.It works well if no strange characters but getting conversion error if there is strange character in data. I am using below code in my function module before sending data out from system in XML format.
Call function to get code page for language
CALL FUNCTION 'SCP_CODEPAGE_FOR_LANGUAGE'
LANGUAGE = if_langu "Chinese
CODEPAGE = lf_codepage. "Codepage for Chinese
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
text = request "my data
mimetype = ''
buffer = lf_xstring. "Hexdecimal format
*.Call Method cl_abap_conv_x2x_ce=>create to convert Hexa decimal string
*.From Source code page to Unicode
lcn_conv_x2x = cl_abap_conv_x2x_ce=>create(
in_encoding = lf_codepage "tried pass UTF-8 as well, but did not work
in_endian = 'L'
out_encoding = '4110'
out_endian = 'B'
input = lf_xstring ).
lcn_conv_x2x->reset( input = lf_xstring ).
*.Now Convert to Unicode
CALL METHOD lcn_conv_x2x->convert_c.
CATCH cx_sy_conversion_codepage cx_sy_codepage_converter_init.
WRITE : / 'Conversion Error'.
*.Buffer out Finally
lf_xstring = lcn_conv_x2x->get_out_buffer( ).
ENDIF. "Check in encoding
CALL METHOD lf_client->request->set_data
data = lf_xstring.
*********************----> I am getting communicatin failure error if there is #%^& characters here
CALL METHOD lf_client->send
http_communication_failure = 1
OTHERS = 999.
I tried to add below code at beginning but it works onlly for English data with strange characters but not for other languages.
CALL METHOD cl_http_utility=>escape_url
unescaped = request
OPTIONS = 1
escaped = request.
Does anyone has some thoughts to solve this issue,
<< Moderator message - Please do not promise points >>
<< Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
Edited by: Anil Yedlapalli on Jun 13, 2011 1:42 AM
Edited by: Rob Burbank on Jun 13, 2011 10:05 AM