use of Java in C++ plugin
Miso Krupicka last edited by
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?
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().