diff --git a/code/ibmmq/__init__.py b/code/ibmmq/__init__.py index 9ecec7d..cbb0a0a 100644 --- a/code/ibmmq/__init__.py +++ b/code/ibmmq/__init__.py @@ -206,6 +206,9 @@ def to_string(v, encoding=EncodingDefault.bytes_encoding): """ if isinstance(v, bytes): try: + null_index = v.find(0) + if null_index != -1: + v = v[:null_index] return v.decode(encoding).strip() except UnicodeError: pass