Dealing with chinese characters in JNI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rukawa
    New Member
    • Dec 2008
    • 2

    Dealing with chinese characters in JNI

    Hi everyone, I'm currently working on JNI and need some help regarding the storage of chinese characters.

    Within Java, I have a String of chinese characters and this i send into C++, which accepts it as a jstring. I'll need to use this string as a char* format to input into other DLLs, and have tried many conversions but I just can't get back the chinese characters in char* form. Can anyone help me in this by giving a short example code please? Thanks alot!
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    That Java String is passed to C or C++ as a jstring. The JNI interface offers a few functions that can extract the UTF-8 encoded char sequences. Read the fine manual.

    kind regards,

    Jos

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      That is, research Unicode.

      No one today writing serious code should be using char*.

      Comment

      • rukawa
        New Member
        • Dec 2008
        • 2

        #4
        Ok, thanks to both to you :)

        Anyway, the other DLLs require char* as input, that I can't change, but well, thanks for the pointer, I'll bear that in mind for future coding :)

        Regards,
        Rukawa

        Comment

        Working...