Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Encoding bug in NP++ 4.1.2

2007-07-31
2012-11-13
  • Recently, I found some trivial bug in Notepad++ 4.1.2.
    This bug is related with encoding option.
    I think that this bug is critical in the country which uses 2-byte character.

    #1. Wrong encoding option is applied to the document when you change encoding option. Change encoding from ANSI to UTF-8, and then revert it(UTF-8 to ANSI). Now you can see the document is setted wrong codepage. You can solve this problem to change following source code.

    Notepad_plus.cpp 2723 line
    _pEditView->execute(SCI_SETCODEPAGE, isUnicodeMode?SC_CP_UTF8:_pEditView->getCodpage());

    #2. Wrong encoding option is applied to the first created document after running Notepad++ when unicode encoding(UTF-8, UCS2, UCS4) is default encoding option. You can solve this problem to change following source code.

    ScintillaEditView.cpp 513 line
    if (isCJK())
    {
        if (getCurrentBuffer()._unicodeMode == uni8Bit)
            execute(SCI_SETCODEPAGE, _codepage);
        else
            execute(SCI_SETCODEPAGE, SC_CP_UTF8);
    }

     
    • MJG
      MJG
      2007-08-07

      Nice catch.  You should post a bug report with your findings.  --Joel