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
Encoding in StatusBar #405
Comments
The short answer is...I don't know. 😄 I barely know how to properly handle encoding, but when it starts to come to mixing Qt, uchardet (which isn't being fully utlized), and Scintilla (that has it's own codec handling) it gets rather confusing very quickly.
Maybe both? Scintilla needs the proper code page, but also the file encoding might need stored somewhere to properly save the file back to disk? Unfortunately, I don't have any good answers. I tried to dig into Notepad++ a while back to see how it handles this, but the code is a bit messy and hard to match up with Qt in places. If it is something you are wanting to look into I think whatever you determine is fine. Even if it isn't the perfect solution, I think any kind of improvements are desirable. |
I spent some time looking at this. I think the first step (not a perfect solution) is to focus on UTFxx and ignoring uchardet for now. So something like this:
As you suggested the encoding is better to be shown in the status bar. I have most of this working already but the encoding APIs changed enough between Qt5 and Qt6 enough to make this annoying. Qt5 actually is easier to work with. Things that still need to be considered:
|
The encoding in the status bar currently shows the code page of the editor.
instead of the file's encoding.
You may open a non-UTF-8 encoding file to reproduce the issue.
And there are many test files in uchardet:
NotepadNext\src\uchardet\test
NotepadNext/src/NotepadNext/widgets/EditorInfoStatusBar.cpp
Lines 148 to 150 in 6ab8354
NotepadNext/src/NotepadNext/ScintillaNext.cpp
Line 524 in 6ab8354
I am not sure how to fix this issue:
editor->codePage()
after detecting the file encodingScintillaNext
) to save the file encodingThe text was updated successfully, but these errors were encountered: