From 5c7f994431cd449654604146c852519bf37e3204 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 5 Nov 2025 13:59:34 +0000 Subject: [PATCH] Updated to_string() to strip NULLs --- code/ibmmq/__init__.py | 3 +++ 1 file changed, 3 insertions(+) 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