Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    use of Java in C++ plugin

    Plugin Development
    2
    2
    2221
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Miso Krupicka
      Miso Krupicka last edited by

      hello

      would it be possible to use JNI to provide some Java functionality to a C++ plugin? (proof of concept)
      my plugin needs to read the whole document, then do some character manipulation and write to a new document
      i am thinking about using Java StringBuilder (i am more familiar with Java then C++, also i am more familiar with Java data structures)
      do i need to do any character encoding/decoding conversions in order to get the text from scintilla control (i assume the text will be encoded/decoded in UTF-8 when it gets from Scintilla into C++ - my default setting in NPP is UTF-8)
      but Java Strings are encoded in UTF-16 internally
      what about encoding/decoding the other way back Java->C+±>Scintilla control
      is that a problem? or am i missing anything? do i need to worry about this at all?

      thanks

      1 Reply Last reply Reply Quote 0
      • dail
        dail last edited by

        would it be possible to use JNI to provide some Java functionality to a C++ plugin?

        AFAIK this would certainly be possible assuming you know enough about JNI.

        do i need to do any character encoding/decoding

        Most likely. Getting the text from Scintilla just gives you a const char * to the text however it is currently set to be encoded. You’d also want to make sure any text inserted/added to Scintilla also has the proper encoding (SCI_GETCODEPAGE may be useful to you). Depending on what you are doing you can probably do this in either Java or C++ (I don’t know enough about JNI). When writing C++ plugins I’ve normally used MultiByteToWideChar() and WideCharToMultiByte().

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright © 2014 NodeBB Forums | Contributors