zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
2.56k stars 179 forks source link

大日志文件GBK模式打不开 #719

Closed huatiao closed 9 months ago

huatiao commented 11 months ago

1.8G日志文件,UTF-8模式可以打开,GBK模式打不开

zufuliu commented 11 months ago

When loading file as GBK (or other encoding other than UTF-8 or ANSI), Notepad2 converts document content from GBK to UTF-16, then UTF-16 to UTF-8, due to the limitation of MultiByteToWideChar() and WideCharToMultiByte(), it's may fails when file size is near 2GB. https://github.com/zufuliu/notepad2/blob/90dfbf8f6370b2410a692cdab092ff190e234e48/src/Edit.h#L423-L424

You can use menu File -> Reload -> As ANSI to reload the file with ANSI (GBK in your case) encoding.

zufuliu commented 11 months ago

Unckeck "Open ANSI (unknown encoding) files in UTF-8 mode." (from menu File -> Encoding -> Default...) should speedup loading ANSI files. image

https://github.com/zufuliu/notepad2/blob/90dfbf8f6370b2410a692cdab092ff190e234e48/src/Edit.c#L1105-L1111