Symptômes
é,è,Ã: UTF-8 lu comme Windows-1252/Latin-1.�: texte non UTF-8 lu comme UTF-8.
Prévenir
- Python :
open(f, encoding="utf-8"); CSV Excel :utf-8-sig(CSV). - HTML :
<meta charset="utf-8">en premier danshead. - Bases de données :
utf8mb4(MariaDB). - PowerShell :
Out-File -Encoding utf8.
Réparer
- VS Code : clic sur l'encodage (barre d'état) › Rouvrir avec l'encodage › Windows 1252 › puis Enregistrer avec l'encodage › UTF-8.
- Texte déjà abîmé :
t.encode("cp1252").decode("utf-8")ou la bibliothèqueftfy.