jenkins-bot has submitted this change and it was merged.

Change subject: Allow unicode usernames in headers
......................................................................


Allow unicode usernames in headers

Headers are bytes (with either an undefined encoding or latin-1, but
that does not stop us from putting in data that's actually utf-8, as
MW does with MySQL).

Bug: 69354
Change-Id: I062d16604a8b87b5d0c598d4936eca2ecb8303f2
---
M pywikibot/comms/http.py
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  Eranroz: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 69789e1..5edbd62 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -158,10 +158,11 @@
         username = site.username()
         if not username:
             username = ""
+
         kwargs["headers"]["user-agent"] = config.USER_AGENT_FORMAT.format(
             script=pywikibot.calledModuleName(),
             version=pywikibot.version.getversiondict()['rev'],
-            username=quote(username),
+            username=quote(username.encode('utf-8')),
             lang=site.code,
             family=site.family.name)
     else:

-- 
To view, visit https://gerrit.wikimedia.org/r/153221
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I062d16604a8b87b5d0c598d4936eca2ecb8303f2
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Eranroz <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to