From 53b5bdef6948684c67329be37f851611366fe14f Mon Sep 17 00:00:00 2001 From: agessaman Date: Sun, 15 Feb 2026 21:43:37 -0800 Subject: [PATCH] Enhance configuration file reading to support UTF-8 encoding - Updated the `MeshCoreBot` class to read the configuration file with UTF-8 encoding, ensuring proper parsing of emoji and non-ASCII characters on Windows. - Applied the same encoding change to the configuration reload logic, maintaining consistency across configuration handling. --- modules/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/core.py b/modules/core.py index 3fc8324..a1c3b1d 100644 --- a/modules/core.py +++ b/modules/core.py @@ -260,7 +260,8 @@ class MeshCoreBot: if not Path(self.config_file).exists(): self.create_default_config() - self.config.read(self.config_file) + # Force UTF-8 so emoji and non-ASCII characters in config.ini parse on Windows. + self.config.read(self.config_file, encoding="utf-8") def _get_radio_settings(self) -> Dict[str, Any]: """Get current radio/connection settings from config. @@ -298,7 +299,7 @@ class MeshCoreBot: if not Path(self.config_file).exists(): return (False, "Config file not found") - new_config.read(self.config_file) + new_config.read(self.config_file, encoding="utf-8") # Get new radio settings new_radio_settings = { @@ -322,7 +323,7 @@ class MeshCoreBot: self.logger.info("Reloading configuration (radio settings unchanged)") # Reload the config - self.config.read(self.config_file) + self.config.read(self.config_file, encoding="utf-8") # Update rate limiters new_rate_limit = self.config.getint('Bot', 'rate_limit_seconds', fallback=10)