5

I want to escape this string in SAPUI5 like this.

var escapedLongText = escape(unescapedLongText);

String (UTF-8 quote, space, Unicode quote)

" “

Escaped string

%22%20%u201C

I want to unescape it with this method, but it returns empty. Any ideas?

DATA: LV_STRING TYPE STRING.

LV_STRING = '%22%20%u201C'.

CALL METHOD CL_HTTP_UTILITY=>UNESCAPE_URL
  EXPORTING
   ESCAPED   = LV_STRING
RECEIVING
    UNESCAPED = LV_STRING.
Matthijs Mennens
  • 1,125
  • 9
  • 33

1 Answers1

2

I changed the code in SAPUI5 to the following:

var escapedLongText = encodeURI(unescapedLongText);

This results in: (like andreas mentioned)

%22%20%e2%80%9c

If I want to decode it later in SAPUI5, it can be done like this:

var unescapedLongText = unescape(decodeURI(escapedLongText));

The unescape needs to be done, because commas (for example) don't seem to be decoded automatically.

Matthijs Mennens
  • 1,125
  • 9
  • 33