I'm trying to find anywhere that I can access a URLEncoder function. I know this is a java class, but can't find anywhere in Mendix that it exists. The problem is that I have a public REST service I'm calling (GET) that needs a string passed, the string must be URL encoded. the biggest problem is spaces, but also question marks and other characters. I'm getting around the issue by using replaceAll function, but that's just a hack.
The REST module has a urlEncode java action, does this not suffice?
Niels van de Sande
Hi James, this issue dates back from a year ago, in Mx 6.6.
As of Mx 7.1, you can create a String variable using urlEncode and urlDecode, see example below.
Johan Flikweert - old account
I have also been torubleshooting this problem. I have found a suitable solution if you first use the urlEncode function when creating the string you want to pass. Then have a Change Variable action which replaceAll '\+'(backslash in order to escape the +) with '%20' on the original variable you created then it should work. If not then drop me a message