1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-12-02 09:43:30 +00:00

swap order of encoder search

As described by @scott-r in
Magic encoder does not use
previously used code pages
when possible #570
Thank you!
This commit is contained in:
Patrick Kanzler
2023-10-05 14:41:15 +02:00
parent 8f76578dfa
commit af74ed00c6
2 changed files with 6 additions and 1 deletions

View File

@@ -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.