From d4fec8c5de388eeb146ececbd022db784cc75d1f Mon Sep 17 00:00:00 2001 From: "Andrzej (Andy)" Date: Wed, 17 Jun 2020 14:39:21 +0200 Subject: [PATCH] Default charset for json is utf-8 --- agithub/base.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/agithub/base.py b/agithub/base.py index 88b8a31..c3c373e 100644 --- a/agithub/base.py +++ b/agithub/base.py @@ -285,9 +285,13 @@ def parseContentType(self, ctype): self.ctypeParameters = {} if 'charset' not in self.ctypeParameters: - self.ctypeParameters['charset'] = 'ISO-8859-1' - # NB: INO-8859-1 is specified (RFC 2068) as the default - # charset in case none is provided + if ctype == 'application/json': + self.ctypeParameters['charset'] = 'utf8' + # RFC 4627 says JSON text SHALL be encoded in Unicode. The default encoding is UTF-8. + else: + self.ctypeParameters['charset'] = 'ISO-8859-1' + # NB: INO-8859-1 is specified (RFC 2068) as the default + # charset in case none is provided def mangled_mtype(self): """