From a9de79a55062b02b7736ecd409a7bcc8f699bf6f Mon Sep 17 00:00:00 2001 From: Richard Brock Date: Mon, 6 Mar 2017 13:00:21 -0500 Subject: [PATCH] Apply the new file custom encoding to an opened empty file Closes #2997, fixes #2947, fixes #1874 --- PowerEditor/src/ScitillaComponent/Buffer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 9433d2d91..2935527d4 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -1467,6 +1467,11 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, NppParameters *pNppParamInst = NppParameters::getInstance(); const NewDocDefaultSettings & ndds = (pNppParamInst->getNppGUI()).getNewDocDefaultSettings(); // for ndds._format eolFormat = ndds._format; + //for empty files, set the encoding to the default for new files + if (fileSize == 0) + { + encoding = ndds._unicodeMode; + } } else {