APK errors

Excel breaks the letter ə

Excel can open a UTF-8 file that has no BOM with the system table. On Azerbaijani Windows that table is the Turkish one, cp1254. It has ü, ö, ş, ğ, ç, and ı. It does not have ə. The letter becomes ? or another mark.

utf-8 is right for other programs. It is not enough for Excel. utf-8-sig puts three bytes at the start, and Excel reads the file as UTF-8.

Do not change everything at once. Check the cause in order.

  • Write the file like this: open("metn.csv", "w", newline="", encoding="utf-8-sig").
  • encoding="utf-8" is enough for Notepad and a browser. Excel may open it with another table.
  • Do not write cp1254. That table has no ə.
  • If ə is already ? in the old file, code cannot bring the letter back. Write the text again.
  • newline="" is for the blank row. It does not change the letter ə.

This is not the square in the console. If the letter is a square there, do not change the code. Change the font.

with open("metn.csv", "w", newline="", encoding="utf-8-sig") as fayl:
    fayl.write("ad\nAzərbaycan\n")

Related guides