diff --git a/.mailmap b/.mailmap index fe88047..fb0069e 100644 --- a/.mailmap +++ b/.mailmap @@ -13,6 +13,7 @@ csoft2k Sergio Pulgarin reck31 Alex Debiasio +白月秋见心 Maximilian Wagenbach belono Benito López diff --git a/AUTHORS b/AUTHORS index 07c6bce..cc15f85 100644 --- a/AUTHORS +++ b/AUTHORS @@ -41,3 +41,4 @@ Thijs Triemstra Thomas van den Berg Yaisel Hurtado ysuolmai +白月秋见心 diff --git a/src/escpos/magicencode.py b/src/escpos/magicencode.py index 4b6f9cb..bc0bb7f 100644 --- a/src/escpos/magicencode.py +++ b/src/escpos/magicencode.py @@ -18,6 +18,7 @@ from .constants import CODEPAGE_CHANGE from .exceptions import Error from .codepages import CodePages import six +import re class Encoder(object): @@ -252,6 +253,10 @@ class MagicEncode(object): self.write_with_encoding(self.encoding, text) return + if re.findall(r"[\u4e00-\u9fa5]", text): + self.driver._raw(text.encode("GB18030")) + return + # See how far we can go into the text with the current encoding to_write, text = split_writable_text(self.encoder, text, self.encoding) if to_write: