From cfcbb518854cb990f71f960b642a803f47519d54 Mon Sep 17 00:00:00 2001
From: Sergey
Date: Sun, 17 May 2026 16:00:45 +0700
Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B4=D0=B5=D0=BA=D0=BE=D0=B4=D0=B8?=
=?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20Windows-1251=20?=
=?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=D0=B8?=
=?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D1=85=20=D0=BA=D0=BE=D0=BC=D0=BC?=
=?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B5=D0=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
monitor.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/monitor.py b/monitor.py
index 298f758..991b1c0 100644
--- a/monitor.py
+++ b/monitor.py
@@ -71,9 +71,12 @@ def notify(message: str) -> None:
# MikroTik: получить список IP из address-list
# ──────────────────────────────────────────────
def decode(val) -> str:
- """Декодирует bytes или str, игнорируя ошибки кодировки."""
+ """Декодирует bytes или str. Пробует UTF-8, затем Windows-1251."""
if isinstance(val, bytes):
- return val.decode("utf-8", errors="replace")
+ try:
+ return val.decode("utf-8")
+ except UnicodeDecodeError:
+ return val.decode("windows-1251", errors="replace")
return str(val) if val else ""