Re: how to communicate unsigned char* to Java

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi

Well! why don't you just write it with char* and read it via
java string.

This will not work, allthough it _may_ work on some bunch of data.

Because: Strings in Java are Unicode (aka UTF-16). An not every sequence of
bytes is valid Unicode. Unicode Implementations may substitute the illegal
chars with something else, or throw an error.

Now write some funny code to elaborate those strings to
meaningful values;-)

Converting random binary data into a Unicode-String and converting this
Unicode-String back to binary data will not produce the same data again in
many cases.

While in a "none-unicode" world Strings could be used to carry some binary
data (allthough it was never a good coding practice), these techniques will
not work propery when you have unicode DataTypes and Parsers.

You just have to use the byte - Datatype to read arbitary binary data in
Java.


GP


.



Relevant Pages

  • Data entry in foreign languages
    ... To what extent can you ignore the foreign language problem for ... do the OS keyboard drivers and Unicode handle everything? ... Do the Strings read right to left ... http://mindprod.com Java custom programming, consulting and coaching. ...
    (comp.lang.java.programmer)
  • Re: Investigating Ruby - key limitations ?
    ... > The VM executes compiled java code. ... From what I have read ruby does not have that. ... I've done Unicode work. ... Do you want UTF-8 strings? ...
    (comp.lang.ruby)
  • Re: Strange problems with encoding
    ... SQLObject doesn't support the binary data. ... so they're not really unicode strings at all? ... Perhaps the utf-16-le codec would be the ...
    (comp.lang.python)
  • Re: What is the best charset to choose for binary serialization
    ... i need to binary serialize some strings in a Java application. ... Unicode didn't have more than 65536 codepoints defined yet... ... UTF-8 is pretty common and is ...
    (comp.lang.java.programmer)
  • Re: Data entry in foreign languages
    ... There are ample example strings and web tools for the varients of ... Another way is to save examples and read binary input into Java Strings ... Strings can be concatinated without trouble as long as same Unicode ...
    (comp.lang.java.programmer)