There is not any encoding description label on the right bottom corner. as picture below:
so I can’t click the label to change encoding.
My solution
but I find a way to fix this problem, I ask Cursor to fix it, it give me a advice. After trying, it works fine.
following is the conversation:
ME:
the `README.md` file can’t read and can’t open. it is a binary file, try to analysis the reason, and tell me how to fix it.
Cursor:
README.md is not corrupted. It is UTF-16 Little Endian with no BOM, so tools treat it as binary.
Why it looks “binary”
A hex dump of the start of the file:
23 00 20 00 49 00 6D 00 61 00 67 00 65 00 ...
# I m a g e ...
Each ASCII character is followed by a 0x00 byte. The file is 1642 bytes and contains 605 null bytes.
That encoding is typical of:
- “Unicode” / UTF-16 in Notepad or older Windows editors
- PowerShell
Out-File / Set-Content without -Encoding utf8 (Windows PowerShell 5.1 defaults to UTF-16 LE)
- Some Visual Studio “Unicode” save options
There is no BOM (FF FE), so editors cannot guess UTF-16 and fall back to “binary / unknown”.
Effects:
| Tool |
What happens |
| Cursor / this Read tool |
Refuses .md with NUL bytes |
| Git |
Treats the file as binary (git diff shows no text hunks) |
| GitHub |
Markdown is not rendered |
| VS / Notepad |
May refuse to open, or show garbage |
The file is valid UTF-16 LE. Decoded, it is normal README text (# Image Cleaner, Chinese description, dotnet commands, etc.). It was already committed that way in 70b3989 (Add Image Cleaner WPF app...). Other project text files (.cs, .xaml, etc.) do not have this problem—only README.md.
How to fix
Re-save as UTF-8 (no BOM). That is what Git, GitHub, and Cursor expect for Markdown.
PowerShell (recommended):
$path = "d:\Document\***\project\Pic-BG-Cleaner\README.md"
$text = [System.IO.File]::ReadAllText($path, [System.Text.Encoding]::Unicode)
$utf8 = New-Object System.Text.UTF8Encoding $false
[System.IO.File]::WriteAllText($path, $text, $utf8)
Encoding.Unicode here means UTF-16 LE. $false means no UTF-8 BOM.
Avoid this in Windows PowerShell 5.1:
Set-Content README.md -Encoding utf8 # often writes UTF-8 *with* BOM
Out-File README.md # defaults to UTF-16 LE — this is likely how it broke
After converting:
- Reopen
README.md in Cursor — it should be normal text.
git diff README.md should show a real text diff, not Binary files differ.
- Commit the converted file when you are ready.
I am in Ask mode, so I cannot rewrite the file for you. Switch to Agent mode if you want this conversion applied automatically.
@deanrie