Get current NPP/Scintilla coding

  • StanE

    StanE - 2013-10-27

    Hi. How do I get the current coding used in NPP menu (the one selected in NPP, e. g. ANSI, UTF-8, UCS-2)? Is there a windows message which I could send to NPP or Scintilla? I searched for it but I didn't found anything related.

  • Predelnik

    Predelnik - 2013-10-28

    Well there's message:

    Returns value : if error -1, otherwise encoding number. enum UniMode - uni8Bit 0, uniUTF8 1, uni16BE 2, uni16LE 3, uniCookie 4, uni7Bit 5, uni16BE_NoBOM 6, uni16LE_NoBOM 7

    But if you interact with Scintilla, you should probably use SCI_GETCODEPAGE message, which will return you either 0 which means default one-byte encoding either SC_CP_UTF8 (65001) which means UTF-8 (it also has support for Japanese and some other non-standard encodings but I'm not sure that it's used in NP++ at all). All the get/insert/replace text operations with scintilla will be done in encoding provided by this message.

    And one more tip, if you're interested in developing plugins, most likely it's very useful to bookmark these two pages (for instance, there you can find the info I provided above):

  • StanE

    StanE - 2013-10-28

    This is very helpful information. Thank you, Predelnik!


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks