rabukasim / tools /debug /scripts /fix_encoding_mixin_v2.py
trioskosmos's picture
chore: remove large files for HF Space
9bd4ce5
path = r"c:\Users\trios\.gemini\antigravity\vscode\loveca-copy\engine\game\mixins\effect_mixin.py" with open(path, "r", encoding="utf-8", errors="ignore") as f: text = f.read() # Replace the problematic color_map line old_color_map = 'color_map = {"��": 1, "?E: 4, "?E: 3, "?E: 2, "��": 5, "�s���N": 0}' new_color_map = 'color_map = {"\u8d64": 1, "\u9752": 4, "\u7dd1": 3, "\u9ec4": 2, "\u7d2b": 5, "\u30d4\u30f3\u30af": 0}' # We need to find the actual line because it might be slightly different due to Mojibake import re text = re.sub(r"color_map = \{.*?\}", new_color_map, text) # Fix the strip line text = re.sub(r"\.strip\(.*?\)", '.strip("\u300c\u300d")', text) # Remove any remaining weird lines from the previously failed replacement text = re.sub(r'if "?????D??.*?\n.*?\n.*?\n', "", text) # Also fix the Modal options in _handle_choice if they exist text = text.replace('choice == "�`���R�~���`E', 'choice == "\u30c1\u30e7\u30b3\u30df\u30f3\u30c8"') text = text.replace('choice == "���Ȃ�E', 'choice == "\u3042\u306a\u305f"') text = text.replace('choice == "��?E�mE', 'choice == "\u305d\u306e\u4ed6"') with open(path, "w", encoding="utf-8") as f: f.write(text) print("Aggressive encoding fix applied.")