Skip to content

Commit f4c2051

Browse files
committed
Fix crash when sending UTF-8 characters.
The `ensure_ascii` kwarg in `json.dumps()` must be `True` (the default) so that the subsequent UTF-8 encoding works correctly.
1 parent bf7cecf commit f4c2051

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyapns/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ def binaryify(t):
232232
'token "{}" could not be decoded: {}'.format(str(t), str(e)
233233
))
234234

235-
encoded_payload = json.dumps(self.payload, separators=(',', ':'),
236-
ensure_ascii=False).encode('utf-8')
235+
encoded_payload = json.dumps(self.payload,
236+
separators=(',', ':')).encode('utf-8')
237237
return structify(binaryify(self.token), self.internal_identifier,
238238
self.expiry, encoded_payload)
239239

0 commit comments

Comments
 (0)