1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-08-24 09:03:34 +00:00

fix force-encoding REBASE (contains todos)

* fixed the code of forced-encoding in order to make it work
* extended unittest for forced-encoding
* fixed the constant for Katakana-encoding
This commit is contained in:
Patrick Kanzler
2016-07-25 17:25:13 +02:00
parent 046a08896c
commit 87a6647053
3 changed files with 18 additions and 5 deletions

View File

@@ -106,7 +106,7 @@ CHARCODE = {
'PC437':
[ESC + b'\x74\x00', 'cp437'], # PC437 USA
'KATAKANA':
[ESC + b'\x74\x01', 'katakana'], # KATAKANA (JAPAN)
[ESC + b'\x74\x01', ''], # KATAKANA (JAPAN)
'PC850':
[ESC + b'\x74\x02', 'cp850'], # PC850 Multilingual
'PC860':

View File

@@ -143,7 +143,7 @@ class MagicEncode(object):
# make sure the right codepage is set in the printer
buffer = self.codepage_sequence(self.encoding)
if self.force_encoding:
buffer += txt.encode(self.codepage)
buffer += txt.encode(self.codepage_name(self.encoding))
else:
for c in txt:
buffer += self.encode_char(c)
@@ -178,6 +178,7 @@ class MagicEncode(object):
# todo emoticons mit charmap encoden
# todo Escpos liste von unterdrückten charcodes mitgeben
# TODO Sichtbarkeit der Methode anpassen (Eigentlich braucht man nur die set_encode und die encode_text)
TXT_ENC_KATAKANA_MAP = {
# Maps UTF-8 Katakana symbols to KATAKANA Page Codes