

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
10 messages in net.java.dev.jna.usersRe: [jna-users] String related questions| From | Sent On | Attachments |
|---|---|---|
| Bartko Zoltan | Jul 12, 2007 4:49 am | .java, .java |
| Bartko Zoltan | Jul 12, 2007 6:08 am | |
| Wayne Meissner | Jul 12, 2007 6:09 am | |
| Timothy Wall | Jul 12, 2007 8:03 am | |
| Timothy Wall | Jul 12, 2007 8:38 am | |
| Bartko Zoltan | Jul 13, 2007 12:10 am | |
| Bartko Zoltan | Jul 13, 2007 1:05 am | |
| Timothy Wall | Jul 13, 2007 7:11 am | |
| Oleksandr Maksymchuk | Oct 22, 2007 4:25 am | |
| Timothy Wall | Oct 22, 2007 6:34 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] String related questions | Actions... |
|---|---|---|
| From: | Bartko Zoltan (bart...@bartkozoltan.com) | |
| Date: | Jul 12, 2007 6:08:23 am | |
| List: | net.java.dev.jna.users | |
Another thing I have found out:
if I do not use accented characters, the library receives the strings correctly. However, if I use accented characters, weird things happen:
if I execute the following code:
int i = hunspell.Hunspell_spell(pHunspell, "apué"); System.out.println("apué "+i); int j = hunspell.Hunspell_spell(pHunspell, "emberibbé"); System.out.println("emberibbé "+j); i = hunspell.Hunspell_spell(pHunspell, "anyué"); System.out.println("anyué "+i);
I get this:
apué 0 emberibbé 1 anyué 0 DEBUG: apué��wqTA DEBUG: emberibbé DEBUG: anyuébbé
(the lines starting with DEBUG are the result of a printf call in the library to dump the second parameter of the library call to stdout).
Zoltan
Dňa Thursday 12 July 2007 13:49:59 Bartko Zoltan ste napísal:
Hello, folks,
First, kudos for JNA. Second, I have some questions:
I am trying to access hunspell (http://hunspell.sf.net) via JNA under linux.
I have some problems, however. The C header of the library is basically the following:
/* start header */ typedef struct Hunhandle Hunhandle;
Hunhandle *Hunspell_create(const char * affpath, const char * dpath); void Hunspell_destroy(Hunhandle *pHunspell);
/* spell(word) - spellcheck word * output: 0 = bad word, not 0 = good word */ int Hunspell_spell(Hunhandle *pHunspell, const char *);
char *Hunspell_get_dic_encoding(Hunhandle *pHunspell);
/* suggest(suggestions, word) - search suggestions * input: pointer to an array of strings pointer and the (bad) word * array of strings pointer (here *slst) may not be initialized * output: number of suggestions in string array, and suggestions in * a newly allocated array of strings (*slts will be NULL when number * of suggestion equals 0.) */ int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word);
/* end header */
I manage to use the Hunspell_spell method. It gives correct results, but only if the second parameter has no accented characters in it. Is there any way of finding out what is being sent to the library? The function expects UTF-8 encoding on the input.
The other problem of mine is char*** slst in Hunspell_suggest(). What Java type should this have? I tried PointerByReference and during compilation it gave me this:
Compiling 1 source file to /home/bartkoz/devel/j2/build/classes compile: # # An unexpected error has been detected by Java Runtime Environment: # # SIGSEGV (0xb) at pc=0xad46ccaa, pid=3643, tid=3084749728 # # Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 interpreted mode) # Problematic frame: # C [libhunspell-1.1.so+0x14caa] _ZN8Hunspell7suggestEPPPcPKc+0xca # # An error report file with more information is saved as hs_err_pid3643.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # Java Result: 134
Thanks for the answers in advance. I am attaching the test java sources just in case you would need them.
Zoltan








.java, .java