NotepadNext icon indicating copy to clipboard operation
NotepadNext copied to clipboard

Properly handling file Encoding

Open dail8859 opened this issue 4 years ago • 3 comments

There is no file encoding support currently.

I don't understand file encodings enough to know I'm doing it correctly. The uchardet library is linked in which can detect file encodings.

CC: @hongnod

dail8859 avatar Dec 04 '21 16:12 dail8859

When will this function be available?

buer37 avatar Nov 15 '22 07:11 buer37

The short answer is: I don't know.

There are several unknown pieces involving the uchardet library, Qt's text conversion, Scintilla, code pages, etc. So it is definitely no small task and will take some time for me to get the desire to start digging into it.

dail8859 avatar Nov 15 '22 14:11 dail8859

Regardless of the encoding of the file, it will always be saved in utf-8, because the content is converted to utf-8 when it is imported into the editor. Based on the above process, you can specify a non-utf-8 codec when reading a file, and still use utf-8 when importing content into editor, and convert the utf-8 content to the specified codec before saving the file. A similar situation exists for BOM.

If there are not too many encodings to deal with, you can use this method for emergency.

A demo with Simplified Chinese encoding https://mega.nz/folder/NSh1UZBR#cdZZDgQ0kJY-BtAnuM1vyA

bestbai avatar Feb 16 '23 14:02 bestbai