diff options
| author | 2021-08-03 20:37:00 +0100 | |
|---|---|---|
| committer | 2021-08-03 13:20:30 -0700 | |
| commit | a8869b4d60512b173871c886321b261cbc4acca9 (patch) | |
| tree | c44b0ab585bc11f0207757f1730d3106eaffcd40 | |
| parent | Merge pull request #1705 from wookie184/autoreview-toggle (diff) | |
Force utf-8 decoding when querying metabase
Some discord usernames contain unicode characters, which causes an decoding
error as chardet isn't 100% and can't falsely detect the response text as
Windows-1254.
| -rw-r--r-- | bot/exts/moderation/metabase.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/exts/moderation/metabase.py b/bot/exts/moderation/metabase.py index db5f04d83..e9faf7240 100644 --- a/bot/exts/moderation/metabase.py +++ b/bot/exts/moderation/metabase.py @@ -115,12 +115,12 @@ class Metabase(Cog): try: async with self.bot.http_session.post(url, headers=self.headers, raise_for_status=True) as resp: if extension == "csv": - out = await resp.text() + out = await resp.text(encoding="utf-8") # Save the output for use with int e self.exports[question_id] = list(csv.DictReader(StringIO(out))) elif extension == "json": - out = await resp.json() + out = await resp.json(encoding="utf-8") # Save the output for use with int e self.exports[question_id] = out |