diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 958d71b..da44fff 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,11 +12,15 @@ changes - has - changed +- fix the encoding search so that lower encodings are found first + contributors ^^^^^^^^^^^^ - list - contributors +- scott-r in [#570](https://github.com/python-escpos/python-escpos/issues/570) + 2023-05-11 - Version 3.0a9 - "Pride Comes Before A Fall" -------------------------------------------------------- This release is the 10th alpha release of the new version 3.0. diff --git a/src/escpos/magicencode.py b/src/escpos/magicencode.py index c9847e1..7cb17be 100644 --- a/src/escpos/magicencode.py +++ b/src/escpos/magicencode.py @@ -155,7 +155,8 @@ class Encoder(object): def __encoding_sort_func(self, item): key, index = item - return (key in self.used_encodings, index) + used = key in self.used_encodings + return (not used, index) def find_suitable_encoding(self, char): """Search in a specific order for a suitable encoding.