利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
fix(i18n): accept UTF-8 BOM in locale files
KET ⚡92fb01b23501
diff --git a/app/utils/utils.py b/app/utils/utils.pyindex 9184e78b..0a5195c2 100644--- a/app/utils/utils.py+++ b/app/utils/utils.py@@ -536,7 +536,7 @@ def load_locales(i18n_dir):for file in files:if file.endswith(".json"):lang = file.split(".")[0]- with open(os.path.join(root, file), "r", encoding="utf-8") as f:+ with open(os.path.join(root, file), "r", encoding="utf-8-sig") as f:_locales[lang] = json.loads(f.read())return _localesdiff --git a/test/services/test_locale_encoding.py b/test/services/test_locale_encoding.pynew file mode 100644index 00000000..0ba32c82--- /dev/null+++ b/test/services/test_locale_encoding.py@@ -0,0 +1,15 @@+import json++import pytest++from app.utils.utils import load_locales++[email protected]("encoding", ["utf-8", "utf-8-sig"])+def test_locale_loading_accepts_utf8_with_or_without_bom(tmp_path, encoding):+ content = {"label": "Français", "embedded": "keep\ufeffinside"}+ (tmp_path / "fr.json").write_text(json.dumps(content, ensure_ascii=False), encoding=encoding)+ try:+ assert load_locales(str(tmp_path)) == {"fr": content}+ finally:+ load_locales.cache_clear()