Force text to be compatible with CP437

This avoids a conversion error in PyFIS.
This commit is contained in:
Stefan Bethke 2025-06-01 20:43:52 +02:00
commit c1d36b508b

View file

@ -33,6 +33,7 @@ class BubaCmd:
:param align: alignment options, see MIS1TextDisplay.ALIGN_* :param align: alignment options, see MIS1TextDisplay.ALIGN_*
:return: :return:
""" """
text = text.encode("CP437", "replace").decode("CP437") # force text to be CP437 compliant
if self.display is not None: if self.display is not None:
self.display.simple_text(page, row, col, text, align) self.display.simple_text(page, row, col, text, align)
self.send({ self.send({
@ -59,6 +60,7 @@ class BubaCmd:
:param align: alignment options, see MIS1TextDisplay.ALIGN_* :param align: alignment options, see MIS1TextDisplay.ALIGN_*
:return: :return:
""" """
text = text.encode("CP437", "replace").decode("CP437") # force text to be CP437 compliant
if self.display is not None: if self.display is not None:
self.display.text(page, row, col_start, col_end, text, align) self.display.text(page, row, col_start, col_end, text, align)
self.send({ self.send({