Last active
February 13, 2018 06:45
-
-
Save quxiaowei/427435572eac247c31388ac6c885447d to your computer and use it in GitHub Desktop.
[URL Excape] #ABAP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" escape & unescape | |
DATA str_name TYPE string. | |
str_name = cl_http_utility=>if_http_utility~escape_url( str_name ). | |
str_name = cl_http_utility=>if_http_utility~unescape_url( str_name ). | |
" encode | |
DATA conv TYPE REF TO cl_abap_conv_out_ce. | |
conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ). | |
conv->convert( | |
EXPORTING data = v_text | |
IMPORTING buffer = v_json ). | |
" decode | |
DATA conv TYPE REF TO cl_abap_conv_in_ce. | |
DATA buffer TYPE xstring. | |
conv = cl_abap_conv_in_ce=>create( encoding = 'UTF-8' ). | |
buffer = response. | |
conv->convert( | |
EXPORTING input = buffer | |
IMPORTING data = v_text ). | |
" xstring to string | |
DATA json TYPE xstring. | |
v_text = cl_abap_codepage=>convert_from( json ). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment