Is char * supported on Chinese / Japanese machines?

I am trying to create a DLL for authentication using Java and JNI.

To create the DLL, I created a Win32 application whose character set and runtime information are multibyte strings and multi-threaded (/ MT), respectively.

I have tested the DLL on WinXP with valid and invalid user credentials. Both are working fine.

I need to know if this same DLL will work in Chinese and Japanese environments.

Can anyone help me solve this problem?

Thanks in advance.

Hello

Jegan KS

0


source to share


2 answers


It should work fine if you are only treating lines as blobs. When you start referring to them "char -by- char" (ie Byte-wise) things can go wrong if you assume that the C char is a complete charater. Likewise, if you assume that you can split a string in the middle into two substrings, it might go wrong, etc.



It also begs the question how to convert a Java string to such a multibyte string; there are right and wrong ways to do it.

+1


source


What Martin writes is true:

It should work fine if you only ever treat lines as blobs. When you start accessing them "char -by-char" (ie byte-by-byte) things can go wrong if you assume the C char is a complete charater. Likewise, if you assume that you might split a string in the middle into two substrings, it might go wrong, etc.

But this is worse than that. Executing on a Japanese or Chinese system just makes it more likely your code will collide with multibyte (non-ASCII) text. Even working on the American English system (the simplest case), it is entirely possible that your code will collide with multibyte (non-ASCII) text. Don't assume that the strings used in the default UI are the limit of what you might have run into.



Also note that converting your project to "Unicode" (as Microsoft calls it) will not help, because choosing Unicode for Unicode encoding is UTF-16, which has similar issues (less commonly). (In UTF-16, the search term is "surrogate pair".)

Word processing is tricky. Let's go shopping!

+1


source







All Articles