From a83ad60b38897db31d2ee4bd68c95c8bcbf53ca8 Mon Sep 17 00:00:00 2001 From: a3d21 <93191329+a3d21@users.noreply.github.com> Date: Thu, 22 May 2025 11:28:11 +0800 Subject: [PATCH] fix: Chinese encoding under LAN Control (#1114) --- custom_components/xiaomi_home/miot/miot_lan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/xiaomi_home/miot/miot_lan.py b/custom_components/xiaomi_home/miot/miot_lan.py index fd9ff47..5c56a55 100644 --- a/custom_components/xiaomi_home/miot/miot_lan.py +++ b/custom_components/xiaomi_home/miot/miot_lan.py @@ -226,7 +226,7 @@ class _MIoTLanDevice: def gen_packet( self, out_buffer: bytearray, clear_data: dict, did: str, offset: int ) -> int: - clear_bytes = json.dumps(clear_data).encode('utf-8') + clear_bytes = json.dumps(clear_data, ensure_ascii=False).encode('utf-8') padder = padding.PKCS7(algorithms.AES128.block_size).padder() padded_data = padder.update(clear_bytes) + padder.finalize() if len(padded_data) + self.OT_HEADER_LEN > len(out_buffer):