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:
parent
8f76578dfa
commit
af74ed00c6
@ -12,11 +12,15 @@ changes
|
|||||||
- has
|
- has
|
||||||
- changed
|
- changed
|
||||||
|
|
||||||
|
- fix the encoding search so that lower encodings are found first
|
||||||
|
|
||||||
contributors
|
contributors
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^
|
||||||
- list
|
- list
|
||||||
- contributors
|
- 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"
|
2023-05-11 - Version 3.0a9 - "Pride Comes Before A Fall"
|
||||||
--------------------------------------------------------
|
--------------------------------------------------------
|
||||||
This release is the 10th alpha release of the new version 3.0.
|
This release is the 10th alpha release of the new version 3.0.
|
||||||
|
@ -155,7 +155,8 @@ class Encoder(object):
|
|||||||
|
|
||||||
def __encoding_sort_func(self, item):
|
def __encoding_sort_func(self, item):
|
||||||
key, index = 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):
|
def find_suitable_encoding(self, char):
|
||||||
"""Search in a specific order for a suitable encoding.
|
"""Search in a specific order for a suitable encoding.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user