[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:
Don Ho 2009-11-22 11:39:03 +00:00
parent de6f421c9c
commit 8bb48853d9
3 changed files with 2 additions and 3 deletions

View File

@ -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);

View File

@ -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))

View File

@ -630,7 +630,6 @@ protected:
folderStyle _folderStyle;
NppParameters *_pParameter;
int _codepage;
int _oemCodepage;
bool _lineNumbersShown;
bool _wrapRestoreNeeded;