fix: don't crash on 'utf-8' messages

This commit is contained in:
Panagiotis Georgakopoulos 2023-04-08 19:05:10 +03:00 committed by Asif Saif Uddin
parent a1e6b75dae
commit 6e9e74c8c6
1 changed files with 2 additions and 2 deletions

View File

@ -802,12 +802,12 @@ class Channel(AbstractChannel, base.StdChannel):
self.exchange_types = None
def encode_body(self, body, encoding=None):
if encoding:
if encoding and encoding.lower() != 'utf-8':
return self.codecs.get(encoding).encode(body), encoding
return body, encoding
def decode_body(self, body, encoding=None):
if encoding:
if encoding and encoding.lower() != 'utf-8':
return self.codecs.get(encoding).decode(body)
return body