mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
Magic encoder: fix codepage usage (#580)
* add unit test for issue pointed out by @scott-r in #570 * 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:
@@ -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.
|
||||
|
Reference in New Issue
Block a user