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

Problem with urlencode conversion

Former Member
0 Likes
814

Hi guys,

sorry for this question, but I was looking on Google and probably I'm working with wrong key words, cause I cannot find any help for my problem.

In my example I'm working with 1 special letter but it can be any "non ASCII" letter from UNICODE table.

Novák is name of author of the book.

I'm sending some http request by POST method to ALEPH server (it is library system).

http://www.mysite.com/X?op=find&&request=wau=novák&base=xxx01

Important part of my question is the letter á (czech letter): request=wau= novák.

Now I need to send it in this form: request=wau= nov%c3%a1k

but after conversion by



 lv_string = cl_http_utility=>escape_url( i_uri ).

.

I've got that result: lv_string = nov%e1k.

The same result I've got with FM WWW_URLENCODE

How I can get the HEX code with percents into my http request please?

Thanks a lot for any help

Petr

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
631

Hello Petr!

You can create a custom FM like 'ZWWW_URLENCODE' with the same code of the original. And force the variable :

gui_codepage to '4110'.

Extract of the code :

* if we have a unicode codepage use utf-8
  IF gui_codepage EQ '4103' OR gui_codepage EQ '4102' OR
     gui_codepage EQ '4101' OR gui_codepage EQ '4100'.
    gui_codepage = '4110'.
  ENDIF.

*Begin Modification Petr
    gui_codepage = '4110'.
*End Modification Petr

* create a converter object using the frontend codepage
  encode = gui_codepage.
  conv = cl_abap_conv_out_ce=>create( encoding = encode ).

This will convert the URL to UTF-8.. so novák will be nov%c3%a1k.

Best Regards.

Claudio (Aparatey)

3 REPLIES 3
Read only

Former Member
0 Likes
632

Hello Petr!

You can create a custom FM like 'ZWWW_URLENCODE' with the same code of the original. And force the variable :

gui_codepage to '4110'.

Extract of the code :

* if we have a unicode codepage use utf-8
  IF gui_codepage EQ '4103' OR gui_codepage EQ '4102' OR
     gui_codepage EQ '4101' OR gui_codepage EQ '4100'.
    gui_codepage = '4110'.
  ENDIF.

*Begin Modification Petr
    gui_codepage = '4110'.
*End Modification Petr

* create a converter object using the frontend codepage
  encode = gui_codepage.
  conv = cl_abap_conv_out_ce=>create( encoding = encode ).

This will convert the URL to UTF-8.. so novák will be nov%c3%a1k.

Best Regards.

Claudio (Aparatey)

Read only

Former Member
0 Likes
631

Thank you very very much, now it is working and SOLVED.

I'm trying to give you points but I cannot find a yellow star.

Edited by: Petr Hodbod on Sep 7, 2010 10:17 AM

Read only

Former Member
0 Likes
631

Thanks a lot for your help, now it is working excelently.