From ca493a4dbf7d312b13ca3a05e06df791de538dfb Mon Sep 17 00:00:00 2001 From: Christopher Toth Date: Thu, 29 Oct 2026 12:16:41 -0600 Subject: [PATCH] Write application log files as UTF-8 --- agent-notes/improve-utf8-logs.md | 19 +++++++++++++++++++ logger_setup/logger_setup.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 agent-notes/improve-utf8-logs.md diff --git a/agent-notes/improve-utf8-logs.md b/agent-notes/improve-utf8-logs.md new file mode 100644 index 0000000..90a1710 --- /dev/null +++ b/agent-notes/improve-utf8-logs.md @@ -0,0 +1,19 @@ +# Goal + +Write application log files as UTF-8 on every supported platform. + +# State + +File handlers explicitly request UTF-8. Console handlers and file write mode are unchanged. The existing package/configuration CI runs on this PR; it does not run application logging scenarios. + +# Decisions and why + +QRead, QFeed and QCast log externally supplied titles. Their content must not depend on the Windows locale's default encoding. Use FileHandler's existing encoding argument, available on the consumers' Python 3.8 baseline. + +# Surprises + +The existing helper's filename branch is the only file-handler construction site. + +# Next step + +Read the published PR's checks. Merge and release are outside this task. diff --git a/logger_setup/logger_setup.py b/logger_setup/logger_setup.py index dd82619..f3d8ce9 100644 --- a/logger_setup/logger_setup.py +++ b/logger_setup/logger_setup.py @@ -26,7 +26,7 @@ def create_handler( if filename is None: handler = handler_class() else: - handler = handler_class(filename, mode=handler_mode) + handler = handler_class(filename, mode=handler_mode, encoding="utf-8") handler.setLevel(level) handler.setFormatter(formatter) logger.addHandler(handler)