[BUG_FIXED] Fix the Unicode to ANSI encoding bug.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@574 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/x64
Don Ho 15 years ago
parent 9ebb4b39f5
commit 9746d60cde

@ -4694,16 +4694,27 @@ void Notepad_plus::command(int id)
case IDM_FORMAT_CONV2_UCS_2LE:
{
int idEncoding = -1;
UniMode um = _pEditView->getCurrentBuffer()->getUnicodeMode();
Buffer *buf = _pEditView->getCurrentBuffer();
UniMode um = buf->getUnicodeMode();
int encoding = buf->getEncoding();
switch(id)
{
case IDM_FORMAT_CONV2_ANSI:
{
if (um == uni8Bit)
return;
if (encoding != -1)
{
// do nothing
return;
}
else
{
if (um == uni8Bit)
return;
idEncoding = IDM_FORMAT_ANSI;
// set scintilla to ANSI
idEncoding = IDM_FORMAT_ANSI;
}
break;
}
case IDM_FORMAT_CONV2_AS_UTF_8:

@ -1493,19 +1493,23 @@ void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) {
}
if (mask & BufferChangeUnicode)
{
int enc = CP_ACP;
if (buffer->getUnicodeMode() == uni8Bit)
{ //either 0 or CJK codepage
LangType typeDoc = buffer->getLangType();
if (isCJK())
{
if (typeDoc == L_CSS || typeDoc == L_CAML || typeDoc == L_ASM || typeDoc == L_MATLAB)
execute(SCI_SETCODEPAGE, 0); //you may also want to set charsets here, not yet implemented
enc = CP_ACP; //you may also want to set charsets here, not yet implemented
else
execute(SCI_SETCODEPAGE, _codepage);
enc = _codepage;
}
else
enc = CP_ACP;
}
else //CP UTF8 for all unicode
execute(SCI_SETCODEPAGE, SC_CP_UTF8);
enc = SC_CP_UTF8;
execute(SCI_SETCODEPAGE, enc);
}
}
}

Loading…
Cancel
Save