Text file shows gibberish: how to read it
You open a .txt file and get “café” or rows of � instead of text. The file is not broken: the program just read it in the wrong encoding. Here is where that comes from and how to read the text.
Why it happens
A computer stores text as bytes, and an encoding is the table that turns bytes into letters. Today almost everything uses UTF-8: websites, Mac, Linux, Android and Notepad in recent Windows. Older files often use a regional table such as Windows-1252 (Western European) or Windows-1251 (Cyrillic).
When a file written in one encoding is read in another, letters turn into other characters. The text itself is intact — it only needs to be read correctly.
What the gibberish tells you
café—Ãfollowed by another symbol: the file is UTF-8 but was read as Western European.caf�— diamonds with a question mark: the file is in an older encoding but was read as UTF-8.Привет— lots of «Р» and «С»: Russian text in UTF-8 read as Windows-1251.
1. Open the file in OsonKit
Drop the file on OsonKit. The encoding is detected from the bytes themselves: a mark at the start of the file (BOM) points to UTF-8 or UTF-16; text that decodes as UTF-8 without errors is UTF-8; otherwise OsonKit counts how many bytes look like Cyrillic letters and picks Windows-1251 or Windows-1252. The chosen encoding is shown next to the file. The file is read in your browser and sent nowhere.
- Files up to 10 MB.
- Detected: UTF-8, UTF-16 (with a BOM), Windows-1251 and Windows-1252. Other legacy encodings — Shift_JIS, GBK, EUC-KR, Windows-1254, Windows-1256 and others — are not supported.
- It is a viewer: you can read and copy the text, not edit it.
2. Save the text again as UTF-8
If you need to pass the file on, save it so that it opens everywhere. Copy the text from OsonKit, paste it into a new Notepad document and save. Notepad in Windows 10 (since 2019) and Windows 11 saves as UTF-8 by default, which every modern program and phone understands.
If the gibberish is in a CSV file
The same happens with .csv: an export from a bank or accounting program opens in Excel with à in every name. The CSV viewer detects the encoding the same way as for text and shows the table with normal letters.