BUG when reloading changed file with diff encoding
-
Hi,
I was just using notepad to monitor some text output from one of my c# programs and noticed that, when the file gets rewritten with a different encoding, notepad prompts me to reload the file but does not change the encoding which makes the displayed text a proper mess.
I was actually swearing at my program LOL until I noticed that if I close notepad and then reopen the file everything looks fine. -
Practice some modesty/caution before calling specific behavior a BUG.
Files do NOT have encoding.
Encoding is applied to the file’s byte stream when it is loaded into a buffer within Scintilla.
On load, an automatic detection algorithm is used to select an encoding. Many threads in this forum state a wish for an option to override this automatic selection.
After load the user can override the encoding.The question of whether file reload should re-trigger the automatic detection or not is an open user interface decision with no ONE RIGHT ANSWER.
Since the scenario you described of a file changing its contents in the background in away that will trigger different encoding result from the automatic detection apply to 0.001% of Notepad++ users I think that maintaining the current encoding of the buffer is the choice that benefit the majority of users.