# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1705747277 -3600
# Node ID 2adfa4c60bffd7cda8d7e8e0b1206bd751c620d6
# Parent  22a00956150224b6c4221d1534ec284eed971cf0
Fix strings displaying as repr(bytes) in debug view.

diff -r 22a009561502 -r 2adfa4c60bff controls/DebugVariablePanel/DebugVariableItem.py
--- a/controls/DebugVariablePanel/DebugVariableItem.py	Fri Jan 19 19:58:44 2024 +0100
+++ b/controls/DebugVariablePanel/DebugVariableItem.py	Sat Jan 20 11:41:17 2024 +0100
@@ -255,7 +255,7 @@
 
                 if self.VariableType in ["STRING", "WSTRING"]:
                     # String data value is CRC
-                    num_value = (binascii.crc32(value) & STRING_CRC_MASK)
+                    num_value = (binascii.crc32(value.encode()) & STRING_CRC_MASK)
                 elif self.VariableType in ["TIME", "TOD", "DT", "DATE"]:
                     # Numeric value of time type variables
                     # is represented in seconds
diff -r 22a009561502 -r 2adfa4c60bff runtime/typemapping.py
--- a/runtime/typemapping.py	Fri Jan 19 19:58:44 2024 +0100
+++ b/runtime/typemapping.py	Sat Jan 20 11:41:17 2024 +0100
@@ -42,7 +42,7 @@
     "USINT":      _t(c_uint8),
     "BYTE":       _t(c_uint8),
     "STRING":     (IEC_STRING,
-                   lambda x: x.body[:x.len],
+                   lambda x: x.body[:x.len].decode(),
                    lambda t, x: t(len(x), x.encode() if type(x)==str else x)),
     "INT":        _t(c_int16),
     "UINT":       _t(c_uint16),