fix_encoding.py 528 B

12345678910111213141516
  1. import sys
  2. app_path = 'app.py'
  3. try:
  4. with open(app_path, 'r', encoding='utf-8', errors='replace') as f:
  5. content = f.read()
  6. # Replace the replacement characters with proper 'ç' or 'c'
  7. content = content.replace('Fran\ufffdois', 'François')
  8. content = content.replace('Franois', 'François')
  9. with open(app_path, 'w', encoding='utf-8') as f:
  10. f.write(content)
  11. print("Successfully corrected app.py encoding!")
  12. except Exception as e:
  13. print(f"Error correcting file encoding: {e}")