Skip to Main Content
  • Questions
  • Passing encoded url string containing %3A (colon) truncates everting after the last %3A

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Kjell.

Asked: August 23, 2017 - 1:54 pm UTC

Last updated: August 26, 2017 - 3:24 am UTC

Version: 5.0

Viewed 1000+ times

You Asked

Hi

I am a relative newbie to APEX from Sweden (not so god at english)

I am passing an url string to an apex application where i have encode all special caracters, if there i a %3A (colon) in the url APEX seemes to truncate the value i am passing.

This example pass values to tre fields

http://111.111.111.11:8080/apex/f?p=118:32:::::P32_XX,P32_YY,P32_ZZ,:100030,486,VMKF%3AU%202012%3A50

P32_XX, and P32_YY get the value ok

P32_ZZ only get the value "VMKF:U 2012"
but if i put a %3A att the end of the url like this

http://111.111.111.11:8080/apex/f?p=118:32:::::P32_XX,P32_YY,P32_ZZ,:100030,486,VMKF%3AU%202012%3A50%3A

i works ok and P32_ZZ get the value "VMKF:U 2012:50".

Appreciate help
thanks
Kjell

and Connor said...

Yep, colons are delimiters whether are presented as colons or their hex escaped equivalents.

The typical resolution is a "replace/unreplace" strategy.

For you example, if you want pass:

P100_MY_ITEM:some:string:which:has:colons

you would pass (for example):

P100_MY_ITEM:some@@string@@which@@has@@colons

and then in your Apex application issue are:

x := replace([incoming value],'@@',':')


Hope this helps.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Kjell Andersson, August 25, 2017 - 9:05 am UTC

The answer is useful but it must be a bug in APEX, the problem is only affected with the very last %3A every other %3A in the url works fine.
I think my solution works better when quitting URL with %3A and it requires less code in APEX.
Could there be other issues with ending with a %3A?
Connor McDonald
August 26, 2017 - 3:24 am UTC

It might well be a bug, but I wouldn't be risking mixing up delimiters with values.

More to Explore

APEX

Keep your APEX skills fresh by attending their regular Office Hours sessions.