From 3dc88794c2647d58b95e7a03d97586317e984c04 Mon Sep 17 00:00:00 2001 From: WeijiangChen Date: Wed, 7 Aug 2019 19:38:24 +0800 Subject: [PATCH] Revert "Add Chinese support" This reverts commit 110200dde678a165062707e8ccb985c837ed6f68. --- src/escpos/escpos.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index bf8d070..bfab265 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -501,7 +501,7 @@ class Escpos(object): image = my_code.writer._image self.image(image, impl=impl) - def text(self, txt, chinese=False): + def text(self, txt): """ Print alpha-numeric text The text has to be encoded in the currently selected codepage. @@ -510,14 +510,10 @@ class Escpos(object): :param txt: text to be printed :raises: :py:exc:`~escpos.exceptions.TextError` """ - if chinese: - txt = txt.encode('GB18030') - self._raw(txt) - else: - txt = six.text_type(txt) - self.magic.write(txt) + txt = six.text_type(txt) + self.magic.write(txt) - def textln(self, txt='', chinese=False): + def textln(self, txt=''): """Print alpha-numeric text with a newline The text has to be encoded in the currently selected codepage. @@ -526,7 +522,7 @@ class Escpos(object): :param txt: text to be printed with a newline :raises: :py:exc:`~escpos.exceptions.TextError` """ - self.text('{}\n'.format(txt), chinese=chinese) + self.text('{}\n'.format(txt)) def ln(self, count=1): """Print a newline or more @@ -539,7 +535,7 @@ class Escpos(object): if count > 0: self.text('\n' * count) - def block_text(self, txt, font=None, columns=None, chinese=False): + def block_text(self, txt, font=None, columns=None): """ Text is printed wrapped to specified columns Text has to be encoded in unicode. @@ -550,7 +546,7 @@ class Escpos(object): :return: None """ col_count = self.profile.get_columns(font) if columns is None else columns - self.text(textwrap.fill(txt, col_count), chinese=chinese) + self.text(textwrap.fill(txt, col_count)) def set(self, align='left', font='a', bold=False, underline=0, width=1, height=1, density=9, invert=False, smooth=False, flip=False,