Closed PAvel00m closed 1 year ago
@orsenthil (as an urllib expert)
For those not in the know, parse_qsl is in urllib.parse.
The standard https://www.w3.org/TR/html401/interact/forms.html says that when encoding, spaces are replaced by plus signs. When parsing, the reverse happens.
The behavior in parse_sql is deliberate, there are tests for it.
Here's a simpler example:
>>> import urllib.parse
>>> urllib.parse.parse_qsl("a=b+c")
[('a', 'b c')]
For those not in the know, parse_qsl is in urllib.parse.
The standard https://www.w3.org/TR/html401/interact/forms.html says that when encoding, spaces are replaced by plus signs. When parsing, the reverse happens.
The behavior in parse_sql is deliberate, there are tests for it.
Thanks
When trying to parse a query string
parse_qsl("limit=12&next=eyJsYXN0X2lkIjo1OTgyMDM3MDE2NzQ0LCJsYXN0X3ZhbHVlIjoiQm9sbGUgc2VuemEgZnJvbnRpZXJlIChBdXJvcmEtYmlvZHluYW1pZSnwn5C48J+QuPCfkLgifQ==")
I get:
[('limit', '12'), ('next', 'eyJsYXN0X2lkIjo1OTgyMDM3MDE2NzQ0LCJsYXN0X3ZhbHVlIjoiQm9sbGUgc2VuemEgZnJvbnRpZXJlIChBdXJvcmEtYmlvZHluYW1pZSnwn5C48J QuPCfkLgifQ==')]
at the end of the parameter value the parser has replaced the + sign with a space.
`eyJsYXN0X2lkIjo1OTgyMDM3MDE2NzQ0LCJsYXN0X3ZhbHVlIjoiQm9sbGUgc2VuemEgZnJvbnRpZXJlIChBdXJvcmEtYmlvZHluYW1pZSnwn5C48J+QuPCfkLgifQ==
not equal
eyJsYXN0X2lkIjo1OTgyMDM3MDE2NzQ0LCJsYXN0X3ZhbHVlIjoiQm9sbGUgc2VuemEgZnJvbnRpZXJlIChBdXJvcmEtYmlvZHluYW1pZSnwn5C48J QuPCfkLgifQ==`
Python 3.10 Mac OS