diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 8288efa0b..9b9dbf501 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -699,7 +699,7 @@ BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool d bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Read * UnicodeConvertor, LangType language, int encoding) { const int blockSize = 128 * 1024; //128 kB - char data[blockSize]; + char data[blockSize+1]; FILE *fp = generic_fopen(filename, TEXT("rb")); if (!fp) return false; @@ -743,6 +743,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea lenFile = fread(data, 1, blockSize, fp); if (encoding != -1) { + data[lenFile] = '\0'; WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const char *newData = wmc->encode(encoding, SC_CP_UTF8, data); _pscratchTilla->execute(SCI_APPENDTEXT, strlen(newData), (LPARAM)newData); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 764abae56..31db8aa61 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -241,7 +241,6 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) _pParameter = NppParameters::getInstance(); _codepage = ::GetACP(); - _oemCodepage = ::GetOEMCP(); //Use either Unicode or ANSI setwindowlong, depending on environment if (::IsWindowUnicode(_hSelf)) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 4e993fb5d..56e664cb3 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -630,7 +630,6 @@ protected: folderStyle _folderStyle; NppParameters *_pParameter; int _codepage; - int _oemCodepage; bool _lineNumbersShown; bool _wrapRestoreNeeded;