From fd26bac2688edd56866d894e315b426972b79c39 Mon Sep 17 00:00:00 2001 From: AlexWells Date: Wed, 24 Nov 2021 10:29:09 +0000 Subject: [PATCH] Fix previous commit's unicode handling --- softioc/device.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/softioc/device.py b/softioc/device.py index 58bd86b2..f6ce322f 100644 --- a/softioc/device.py +++ b/softioc/device.py @@ -284,9 +284,9 @@ def truncate_string(value): value = value.decode(errors="replace") return value[:39] if isinstance(value, str) else None else: - if isinstance(value, bytes): + if isinstance(value, bytes): # bytes == str in Python2 value = value.decode("utf-8", errors="replace") - return value[:39] if isinstance(value, str) else None + return value[:39] if isinstance(value, unicode) else None longin = _Device_In('longin', value_to_epics=convert_to_int) longout = _Device_Out('longout', value_to_epics=convert_to_int)