Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文本文件被当做二进制文件打开 #953

Open
softmgr opened this issue Dec 27, 2024 · 2 comments
Open

文本文件被当做二进制文件打开 #953

softmgr opened this issue Dec 27, 2024 · 2 comments

Comments

@softmgr
Copy link

softmgr commented Dec 27, 2024

附件中的.log文件,是一个文本文件。
1234.zip

@zufuliu
Copy link
Owner

zufuliu commented Dec 27, 2024

First 1KB contains C0 control characters (especially continuous NUL bytes).
image

notepad4/src/EditEncoding.cpp

Lines 1038 to 1044 in b591eae

bool MaybeBinaryFile(const uint8_t *ptr, DWORD length) noexcept {
/* Test C0 Control Character
These characters are not reused in most text encodings, and do not appear in normal text files.
Most binary files have reserved fields (mostly zeros) or small values in the header.
Treat the file as binary when we find two adjacent C0 control characters
(very common in file header) or some (currently set to 8) C0 control characters. */

@zufuliu
Copy link
Owner

zufuliu commented Dec 28, 2024

Fixed by a995328.

@zufuliu zufuliu added this to the v25.01 milestone Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants