11.7.2
I am trying to send a URI with query param, but I am not getting a correct format.
If I try to send http://mytest.com/page?navn="test tast tust" as a message to SMS, it breaks.
If I use Uri("mytest.com/page tast tust",false) I am geting it converted, but I recevie it like
http://mytest.com/page?navn="test+tast+tust"
If I try to send "test & tust", the & will not be converted, and it breaks the link when seeing in the phone.
I have got it to work, by converting space to _ and & to X like "test_X_tust", and reconverting it when it comes to the page, but my heart bleeds doing something like that :-)
Is there a spesific way of encoding for sms ?
I don't know about the SMS part but there are some encodings you need to do for urls:
First of all: you cannot use spaces in a URL.
test tast tust (without any quotes) should be sent as test+tast+tust (spaces replaced with +).
For example: server?value=test+tast+tust
“test tast tust” with quotes should be encoded to
%22test+tast+tust%22 (“ replaced with %22 and spaces with +)
For example: server?value=%22test+tast+tust%22
If it follows the rules per RFC 3986 then you should use the Encode() method on the URI object. Basically this- [View:https://github.com/consultingwerk/ADE-Sourcecode/blob/964480c051b0c09a9b75bd02d8453afe5ab35b25/src/netlib/OpenEdge/Net/URI.cls#L684:550:50]
so something like
def var myURI as OpenEdge.Net.URI. def var encodedUri as character. myURI = new URI('http://blah.com/blah?some=x and y'). encodedURI = myURI:Encode().