I want to some space separated parameters to a URL from Java. It seems that a pure space cannot be spent and that needs to be encoded before sending it for its actual work.
String fialURL = "<myURL>?options=name=" + "firstname lastname"
I got an exception saying my URL has an illegal character where there is space. Tons of StackOverflow threads say that I need to encode this space.
I have tried firstname%20lastname, then fistname+lastname instead of "firstname lastname" and I am consistently getting a null result.
Where am I going wrong?
I am trying to get my custom built HTTP Post request to execute the following call to twilio
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/xxxxx/Messages.json' \--data-urlencode 'To=+15558675309' \--data-urlencode 'From=+15017250604' \--data-urlencode 'Body=This is the ship that made the Kessel Run in fourteen parsecs?' \-d 'MediaUrl=https://c1.staticflickr.com/3/2899/14341091933_1e92e62d12_b.jpg' \-u xxxxx:your_auth_token
My custom built request accepts an URL, headers and a body, similar to the HTTP Post form at Hurl.it.
How do I translate the portions
into my URL, headers and body?
Example: The -u part I put into a header with "Authorization: Basic ", and it worked perfectly, the server recognises me. I just can't get it to recognise the From, To, Body parts.
I have a URL string where there are line breaks and carriage returns. E.g.
http://xyz.com/hello?name=john&msg=hello\nJohn\n\rgoodmorning¬e=last\night I went to \roger
Where my actual
msg string is:
note string is
last\night I went to \roger
In order to send it correctly I have to urlencode this
But this encode mess up \n and \r. While I expect \n should get converted to %0A and \r to %0D
I am writing code is ruby. And I tried to take help of
Addressable::URI but no help yet. Other way could be replacing \n and \r manually to %0A and %0D respectively. But that replacement can replace valid character such as
last%0Aight that I don't want. Can anyone suggest a better solution? Thanks.
Does anyone know of any good C++ code that does this?
I'm using Visual Studio 2015 on Windows, C++ and Win32. I have a URL which contains spaces and other unsafe characters. If I paste the un-escaped URL into Postman, Postman correctly escapes them and the request works. But if I put the un-escaped URL into HttpOpenRequest(), some characters but not all are escaped as detected in the receiving system.
Original: https://nsw.redacted.com/ScheduledActivitys;zoneId=urn:www.dec.nsw.gov.au:school:8481;contextId=current?where=[(//ScheduledActivitys/ScheduledActivity/ActivityDate>="2017-08-11") and (//ScheduledActivitys/ScheduledActivity/ActivityDate<="2017-08-11")]
So my question is: what am I supposed to do - escape the characters myself, or rely on the Win32 library to escape them, or try to work around an incomplete implementation in the Win32 Wininet library? Is there a danger it'll be URL-encoded twice? And in other reading it looks like you're not supposed to escape the "query" part of a URL (the piece after the '?') - is that advice not correct? (And what characters are escaped and why do Microsoft escape some and not others?)