APK errors

A WhatsApp chat breaks ə in Excel

A chat exported from an Azerbaijani phone is a line like this: 12.10.2026, 14:05 - Əli: salam. The file is UTF-8. When you double-click it, Excel opens it with the system table. That table has no ə, so the letter becomes ? or another mark.

Do not open the .txt straight in Excel. Write a CSV first and put a BOM at the start.

from pathlib import Path
import csv

text = Path("sohbet.txt").read_text(encoding="utf-8")
rows = []
for line in text.splitlines():
    if " - " not in line or ": " not in line:
        continue
    left, message = line.split(": ", 1)
    when, name = left.split(" - ", 1)
    rows.append((when, name, message))

with open("sohbet.csv", "w", newline="", encoding="utf-8-sig") as fayl:
    writer = csv.writer(fayl)
    writer.writerow(["tarix", "ad", "mesaj"])
    writer.writerows(rows)