diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index bf1da42f8..165bb7311 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -816,7 +816,10 @@ BufferID FileManager::loadFile(const wchar_t* filename, Document doc, int encodi newBuf->_timeStamp = fileNameTimestamp; // restore the encoding (ANSI based) while opening the existing file - newBuf->setEncoding(-1); + if (newBuf->_lang == L_ASCII) + newBuf->setEncoding(NPP_CP_DOS_437); + else + newBuf->setEncoding(-1); // if not a large file, no file extension, and the language has been detected, we use the detected value if (!newBuf->_isLargeFile && ((newBuf->getLangType() == L_TEXT) && (loadedFileFormat._language != L_TEXT))) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index cbd5ea15d..47ac6be49 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -1859,12 +1859,11 @@ void ScintillaEditView::defineDocType(LangType typeDoc) setSpecialStyle(nfoStyle); execute(SCI_STYLECLEARALL); - Buffer * buf = MainFileManager.getBufferByID(_currentBufferID); + Buffer* buf = MainFileManager.getBufferByID(_currentBufferID); - if (buf->getEncoding() != NPP_CP_DOS_437) + if (buf->getEncoding() == NPP_CP_DOS_437) { - buf->setEncoding(NPP_CP_DOS_437); - ::SendMessage(_hParent, WM_COMMAND, IDM_FILE_RELOAD, 0); + MainFileManager.reloadBuffer(buf); } } break;