From 066abee50838e09a96396092565202614576ad37 Mon Sep 17 00:00:00 2001 From: grabowski Date: Wed, 29 Oct 2025 17:35:52 +0700 Subject: [PATCH] Fix JavaScript syntax error with UTF-8 encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed template generation to explicitly use UTF-8 encoding when writing the HTML template file. This resolves JavaScript syntax errors caused by emoji characters (⚠️, 🔌, 🔄) in the shutdown/restart confirmation dialogs. Changes: - Added encoding='utf-8' parameter to template file write operation - Updated template version to 1.9.1 to force regeneration - Ensures all special characters render correctly in browser Fixes error: "Uncaught SyntaxError: Invalid or unexpected token" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- rotary_phone_web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rotary_phone_web.py b/rotary_phone_web.py index 34c312c..e0b030a 100644 --- a/rotary_phone_web.py +++ b/rotary_phone_web.py @@ -151,7 +151,7 @@ BACKUP_ON_WRITE = BACKUP_CONFIG.get('backup_on_write', True) WEB_PORT = SYS_CONFIG['web']['port'] # Template version - increment this when HTML template changes -TEMPLATE_VERSION = "1.9.0" # Updated: Added system shutdown/restart controls +TEMPLATE_VERSION = "1.9.1" # Updated: Fixed UTF-8 encoding for JavaScript special characters # Flask app app = Flask(__name__) @@ -1341,7 +1341,7 @@ def main(): else: print(f"Creating new template at {template_file}") - with open(template_file, 'w') as f: + with open(template_file, 'w', encoding='utf-8') as f: # Write version comment first, then the rest of the template f.write(f'\n') f.write('''