Skip to content
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

Library is crashed because of "no feature in text" #98

Open
mickeyzo12 opened this issue Sep 5, 2021 · 0 comments
Open

Library is crashed because of "no feature in text" #98

mickeyzo12 opened this issue Sep 5, 2021 · 0 comments

Comments

@mickeyzo12
Copy link

mickeyzo12 commented Sep 5, 2021

I put a string from any korean language: "유니코드 국제 회"
crash is occurred because of "no feature in text", this library work normally with english string like "hello world", how can i fix this issue?

Call from c++ via jni:

jmethodID detectSingle = env->GetStaticMethodID(clazz, "detectSingle", "(Ljava/lang/String;)Ljava/lang/String;"); // find method
if (detectSingle == nullptr) {
cerr << "ERROR: method void runDetect() not found !" << endl;
}
else {
text = "유니코드 국제 회";
// Construct a String
jstring jstr = env->NewStringUTF(text.c_str());
// Call the method on the object
jobject result = env->CallStaticObjectMethod(clazz, detectSingle, jstr); // call method
// Get a C-style string
const char* str = env->GetStringUTFChars((jstring)result, NULL);
resultString = str;
}

To Java:

public static String detectSingle(String text) throws LangDetectException { // <=== We will call this
detector = DetectorFactory.create();
detector.append(text);
try {
//System.out.println("Java run result: "+detector.detect());
return detector.detect();
} catch (LangDetectException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "";
}

@mickeyzo12 mickeyzo12 changed the title Library is crash because of "no feature in text" Library is crashed because of "no feature in text" Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant