On Jul 13, 2007, at 3:11 AM, Bartko Zoltan wrote:
As to the conversion: When using the Hunspell spell-checking
library, the
following procedure should be observed:
1. initialize the spell checker with the correct dictionary
2. get the encoding of the dictionary
3. check the spelling of the words sent to the library in the
correct encoding
4. do some final cleanup.
Now, how do I do step 3 (I mean, converting the text I want to
check to the
correct encoding)?
a) change the Java platform default encoding to UTF-8 (google for
this, I don't remember off the top of my head, file.encoding or
something like that)
b) explicitly convert strings to NUL-terminated byte arrays with a
static function and pass the byte array instead of a String:
byte[] convert(String s) {
byte[] buf = s.getBytes("UTF8");
byte[] out = new buf[buf.length+1];
System.arraycopy(...);
out[out.length-1] = 0;
return out;
}
When you get it working, we can look at making it easier to force JNA
to use a specific encoding (assuming "A" is not reliable or is
undesirable).