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

base 64 Encoding for Unicode system doesnt work( Japanese Letters)!!

Former Member
0 Likes
1,522

Hi,

I tried<b> encoding few japanese</b> letters using this below API. system is "<b>UNICODE</b>" enabled.

lv_final_oppt_txt = "&#26085;&#26412;&#12486;&#12473;&#12488;&#26085;&#26412;&#12486;&#12473;&#12488;".

CALL METHOD cl_http_utility=>encode_base64

EXPORTING

unencoded = lv_final_oppt_txt

RECEIVING

encoded = lv_text.

<b>Once after decoding this</b> , i am not getting a proper text out of it.

I have used this below API for decoding.

CALL METHOD cl_http_utility=>decode_base64

EXPORTING

encoded = lv_text

RECEIVING

unencoded = lv_final.

<b>Finally lv_final will have corrupted data like "########".</b>

Can you please tell me how do I go about it..or is there any API which works for all

the character sets..This Base64 encoding API works only for nonunicode system I

suppose..<b>Kindly let me know if u know any base64 encoding API which works for all the character sets..</b>

Thanks,

Shiva.<b></b>

Hi,

I tried<b> encoding few japanese</b> letters using this below API. system is "<b>UNICODE</b>" enabled.

lv_final_oppt_txt = "&#26085;&#26412;&#12486;&#12473;&#12488;&#26085;&#26412;&#12486;&#12473;&#12488;".

CALL METHOD cl_http_utility=>encode_base64

EXPORTING

unencoded = lv_final_oppt_txt

RECEIVING

encoded = lv_text.

<b>Once after decoding this</b> , i am not getting a proper text out of it.

I have used this below API for decoding.

CALL METHOD cl_http_utility=>decode_base64

EXPORTING

encoded = lv_text

RECEIVING

unencoded = lv_final.

<b>Finally lv_final will have corrupted data like "########".</b>

Can you please tell me how do I go about it..or is there any API which works for all

the character sets..This Base64 encoding API works only for nonunicode system I

suppose..<b>Kindly let me know if u know any base64 encoding API which works for all the character sets..</b>

Thanks,

Shiva.<b></b>

1 REPLY 1
Read only

ganesh_padala2
Explorer
0 Likes
865

Here's how you can encode and decode base64 string:


DATA : lv_intial  TYPE string,
       lv_encoded TYPE string,
       lv_final   TYPE string,
       lv_tmp1    TYPE xstring,
       lv_tmp2    TYPE xstring.

lv_intial =  'u65E5u672Cu30C6u30B9u30C8u65E5u672Cu30C6u30B9u30C8'.

* convert string to xstring for use with base64 call
lv_tmp1    = cl_openxml_helper=>string_to_xstring( lv_intial ).

* convert temporary xstring to base64 encoded string
lv_encoded = cl_http_utility=>encode_x_base64( lv_tmp1 ).

* decode encoded string into xstring
lv_tmp2    = cl_http_utility=>decode_x_base64( lv_encoded ).

* convert xtring back to UTF-8
lv_final   = cl_openxml_helper=>xstring_to_string( lv_tmp2 ).

WRITE:/ 'Initial :', lv_intial,
      / 'Encoded :', lv_encoded,
      / 'Decoded :', lv_final.