-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android): some unicode characters not working #65
Conversation
The original code was using NewStringUTF which caused the app to crash when certain unicode characters, such as emojis, were used. So instead I added a helper function that converts the UTF-8 input into jstring manually.
Hi, thank you for the PR! I can see the correctly completion result, but it got unexpected result in the partial token event. We already handled with waiting 2-4 bytes and send token event: Lines 464 to 482 in 4c90a78
It would be great if you could check this problem out, I'll do so when I available. |
Could you elaborate what you meant by partial token events? It might be due to the function I wrote not having a lot of error handlings for invalid UTF-8 characters(in fact it only has one for checking whether the input character is null or not). I didn't include it because as far as I know llama.cpp treats all token values as unicode, but I could be wrong. |
This: llama.rn/android/src/main/jni.cpp Lines 436 to 465 in 4c90a78
Our example also use it. |
3799cf8 should fix the unicode issue and the issue about partial event, so this handle may not be need. Still thank you for the PR! |
No problem, thank you for fixing the code! I was a bit busy last few days and couldn't really check it. |
The original code was using NewStringUTF which caused the app to crash when certain unicode characters, such as emojis, were used.
So instead I added a helper function that converts the UTF-8 input into jstring manually.