[BUG_FIXED] Fix encoding files loading bug.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@568 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
de6f421c9c
commit
8bb48853d9
@ -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);
|
||||
|
@ -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))
|
||||
|
@ -630,7 +630,6 @@ protected:
|
||||
folderStyle _folderStyle;
|
||||
NppParameters *_pParameter;
|
||||
int _codepage;
|
||||
int _oemCodepage;
|
||||
bool _lineNumbersShown;
|
||||
bool _wrapRestoreNeeded;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user