Closed
Description
Long story short
I'm doing a POST request via client.post:
data = aiohttp.FormData({
'FindText': name,
}, charset='windows-1251')
client.post(base_url, params={'RowFrom': offset}, data=data)
where name contains some none-latin text ('хан')
Expected behaviour
POST data should contain: FindText=%D5%E0%ED
Actual behaviour
FindText=%D1%85%D0%B0%D0%BD'
Steps to reproduce
Looking through the code of formdata.py:99
urlencode(data, doseq=True).encode(charset),
I noticed, that data is urlencoded in UTF-8 first and then encoded to windows-1251 (and that has no effect on %D1...).
For now, I just manually do in my code:
data = urlencode({
'FindText': name,
}, encoding='windows-1251')
And I get the string that I need.
Is it a bug? Or am I doing it wrong?
Your environment
Python 3.6.0 (default, Jan 16 2017, 12:12:55)
[GCC 6.3.1 20170109] on linux
---
aiohttp==2.0.3