From cf610751eb5ec2c41031cefc4e7c01351ab38095 Mon Sep 17 00:00:00 2001 From: kicer Date: Fri, 1 May 2026 15:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E6=97=B6=E4=BF=9D=E7=95=99=E6=9B=B4=E5=A4=9A=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scomm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scomm.py b/scomm.py index 6febba5..d00939e 100755 --- a/scomm.py +++ b/scomm.py @@ -42,7 +42,7 @@ def tohex(data: bytes) -> str: def human_string(data: bytes, is_hex: bool = False, encoding: str = 'utf-8') -> str: """将字节数据转换为可读字符串""" - return tohex(data) if is_hex else data.decode(encoding, 'backslashreplace') + return tohex(data) if is_hex else data.decode('utf-8', 'backslashreplace').replace('\x00', '\\x00') def uint16(b: bytes) -> int: """从字节读取无符号16位整数"""