Sync: Complete project state with all MEGA SPRINT V1-V3 features and Codex stubs
This commit is contained in:
53
fix_utf8.py
Normal file
53
fix_utf8.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
# Fix UTF-8 double-encoding corruption in sample_selector.py
|
||||
|
||||
import os
|
||||
|
||||
file_path = '/mnt/c/ProgramData/Ableton/Live 12 Suite/Resources/MIDI Remote Scripts/AbletonMCP_AI/AbletonMCP_AI/MCP_Server/sample_selector.py'
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Replace corrupted UTF-8 sequences with proper Spanish characters
|
||||
# These are double-encoded characters: UTF-8 -> Latin1 -> UTF-8
|
||||
corrupted_to_clean = {
|
||||
'Selecci': 'Selección',
|
||||
'gnero': 'género',
|
||||
'Matching armnico': 'Matching armónico',
|
||||
'Creaci': 'Creación',
|
||||
'batera': 'batería',
|
||||
'automtico': 'automático',
|
||||
'mltiples': 'múltiples',
|
||||
'Validaci': 'Validación',
|
||||
'Penalizaci': 'Penalización',
|
||||
'Detecci': 'Detección',
|
||||
'clculos': 'cálculos',
|
||||
'aceleraci': 'aceleración',
|
||||
}
|
||||
|
||||
for corrupted, clean in corrupted_to_clean.items():
|
||||
# Find the corrupted pattern and fix it
|
||||
# Look for patterns like "SelecciÃÆ'³n" -> "Selección"
|
||||
content = content.replace(corrupted + 'ÃÆ'³', clean)
|
||||
content = content.replace(corrupted + 'ÃÆ'©', clean.replace('ón', 'én') if 'ón' in clean else clean.replace('ción', 'ción'))
|
||||
content = content.replace(corrupted + 'ÃÆ'ÂÂ', clean.replace('ón', 'ín') if 'ón' in clean else clean)
|
||||
content = content.replace(corrupted + 'ÃÆ'¡', clean.replace('ón', 'án') if 'ón' in clean else clean)
|
||||
content = content.replace(corrupted + 'ÃÆ'º', clean.replace('ón', 'ún') if 'ón' in clean else clean)
|
||||
|
||||
# Additional direct replacements for common patterns
|
||||
direct_replacements = [
|
||||
('ÃÆ'³', 'ó'),
|
||||
('ÃÆ'©', 'é'),
|
||||
('ÃÆ'ÂÂ', 'í'),
|
||||
('ÃÆ'¡', 'á'),
|
||||
('ÃÆ'º', 'ú'),
|
||||
('ÃÆ'ÂÂ', ''),
|
||||
]
|
||||
|
||||
for wrong, right in direct_replacements:
|
||||
content = content.replace(wrong, right)
|
||||
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print('UTF-8 corruption fixed successfully')
|
||||
Reference in New Issue
Block a user