# URLEncoding of spaces in query parameters + vs %20

**URL:** <https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499>\
**Category:** Feature Request\
**Tags:** feature-request, tracked, katalon-studio\
**Created:** [December 13, 2019, 11:15am UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499 "2019-12-13T11:15:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredrik.svensson](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@fredrik.svensson](https://forum.katalon.com/u/fredrik.svensson)\
**Post date:** [December 13, 2019, 11:15am UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/1 "2019-12-13T11:15:27Z")

</div>

If I create a GET request with a URL that contains query parameters, they will be automatically added in the query parameter list in Katalon. If any of the values of my query parameters have spaces in them, they will be automatically URL encoded on execution of the query.

My problem is that any space is automatically encoded as a + and not as %20. While it is not necessarily wrong for query parameters it doesn’t work with OData, which is what our REST-APIs talk. In OData a plus character is used for expansion of child records and is treated as a special character. Therefore an OData REST query requires any space to be encoded with %20 instead.

Is there any way to have Katalon not automatically encode your query param values? If I try to put in %20 manually it will encode the ‘%’-sign instead. Tried seeing if I could escape it but it didn’t seem to make a difference. Maybe I’m missing something obvious

The query parameter basically looks like this:  
Name: $filter  
Value: TheKeyColumn eq ‘${TheKeyValue}’

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [December 13, 2019, 1:55pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/2 "2019-12-13T13:55:40Z")

</div>

> [@fredrik.svensson](#):
>
> In OData a plus character is used for expansion of child records and is treated as a special character. Therefore an OData REST query requires any space to be encoded with %20 instead.

I checked the specs here: [https://www.odata.org/](https://www.odata.org/) paying much attention to the ABNF here [http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/abnf/odata-abnf-construction-rules.txt](http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/abnf/odata-abnf-construction-rules.txt) which, at first reading supports the IETF/Tim Berners-Lee (et al) original here: [https://www.ietf.org/rfc/rfc3986.txt](https://www.ietf.org/rfc/rfc3986.txt) .

Admittedly, one can easily go snow-blind reading the specs but I failed to find a reference to support your statement that “+” is “special” in OData. Can you therefore provide the authoritative source for your claim?

> Aside: Searching the above pages is quite easy. Knowing that all authors use the same textual means to discuss specific character notations, I used the browser’s Find feature - Ctrl-F. In your case, I searched for the plus-literal in double quotes: `"+"`   
>   
> Again, I found nothing special about OData’s use of “+” that differed from the TBL original.

I’m only human - I may have missed it. But, to file a Bug Report that Katalon/Groovy/Java is breaking the use of a published internet standard, we need to be precise, accurate and rigorous in that reporting.

Thanks.

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [December 13, 2019, 2:13pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/3 "2019-12-13T14:13:50Z")

</div>

there is a similar discussion here, not sure if it is already in progress or fixed.

> [@HTTP 1.1 400 bad request when the parameter value has space](http://forum.katalon.com/t/http-1-1-400-bad-request-when-the-parameter-value-has-space/36273):
>
> i have a API GET object as attached, i use variable parameter like this at endpoint /${dispenseOrderId} and test case define the id (static value). test case failed error I found the issue is due to the space , when def OrderId = “do-test 1” then HTTP/1.1 400 Bad Request if def OrderId = “do-test” then test case passed. is this Katalon issue or something i need to tweak at object? “response” : { “status” : 400, “statusText” : “”, “httpVersion” : “”, “cookies” : , “headers” : [ { “nam…

@huynguyen any updates?

---

<div class="post-metadata">

**Author:** ![fredrik.svensson](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@fredrik.svensson](https://forum.katalon.com/u/fredrik.svensson)\
**Post date:** [December 13, 2019, 3:21pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/4 "2019-12-13T15:21:58Z")

</div>

Yes I also admit to being human 😄 I probably read the spec a bit too quickly. The mentioning of + is actually in the 4.01 draft spec related to expanded entities and is not actually a part of a query URL but of a context URL:  
[https://docs.oasis-open.org/odata/odata/v4.01/csprd06/part1-protocol/odata-v4.01-csprd06-part1-protocol.html#sec\_CollectionofExpandedEntities](https://docs.oasis-open.org/odata/odata/v4.01/csprd06/part1-protocol/odata-v4.01-csprd06-part1-protocol.html#sec_CollectionofExpandedEntities)

So, saying that a + sign was a special character in a query string in OData was wrong. What isn’t wrong though is that as you point out with the ABNF, it says it expects percent encoding as specified in the rfc3986.

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [December 13, 2019, 3:25pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/5 "2019-12-13T15:25:08Z")

</div>

> [@fredrik.svensson](#):
>
> it says it expects percent encoding as specified in the rfc3986

Yep, I saw that and pretty much backed off the moment I saw it and wrote my response.

@devalex88 @duyluong I think we need some official guidance here since I’m not yet convinced there is a bug you can actually address.

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [December 13, 2019, 4:51pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/6 "2019-12-13T16:51:11Z")

</div>

@Russ_Thomas up to now ithink we cand agree that automaticaly conversion of special characters have to be optional. and why not, to have choices.  
there are at least two (maybe three) use cases

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [December 13, 2019, 4:58pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/7 "2019-12-13T16:58:34Z")

</div>

I think I agree. The specs are the specs. Without knowing _where_ in the source the URL is being built and _how_ it is being built, it’s all conjecture (hence my callout to the devs).

Said another way, I think the OP has a reasonable question (so far as I understand it) which deserves a considered response - but I don’t have the relevant authoritative information to form an answer (again, hence the callout).

Also, this is not a part of Katalon I use - there could be a dead simple solution I’m unaware of 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [December 13, 2019, 6:57pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/8 "2019-12-13T18:57:08Z")

</div>

> [@Russ\_Thomas](#):
>
> there could be a dead simple solution I’m unaware of

i know workarounds. but best solution will be to make such settings/behaviours more transparent … therefore let’s wait for devs input

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [December 15, 2019, 7:39am UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/9 "2019-12-15T07:39:21Z")

</div>

Moved to _Feature / Improvement Suggestions_.

---

<div class="post-metadata">

**Author:** ![Gan\_Jyi\_Yng](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/gan_jyi_yng/32/16104_2.png) [@Gan\_Jyi\_Yng](https://forum.katalon.com/u/Gan_Jyi_Yng)\
**Post date:** [January 17, 2020, 2:03am UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/10 "2020-01-17T02:03:43Z")

</div>

@Ibus could share with me simple solution to have workaround tentatively?

---

<div class="post-metadata">

**Author:** ![Jass](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jass/32/9588_2.png) [@Jass](https://forum.katalon.com/u/Jass)\
**Post date:** [March 9, 2020, 1:42pm UTC](https://forum.katalon.com/t/urlencoding-of-spaces-in-query-parameters-vs-20/37499/11 "2020-03-09T13:42:18Z")

</div>


