My android app has an OCR functionality using tess-two library. I have this issue in reading the String which contains "fi". After baseApi.getUTF8Text(), a method to get the recognized text by the OCR, the returned String in that "fi" is "fi" <<<- - - Take a very close attention to that string. It is not a 2-charactered String but a single-charactered String. You can reproduce that by copying and pasting. Now, I am thinking it might be an issue of UTF8 encoding or etc which I don't have enough knowledge with. When I tried to do string.replace("fi","fi"), Android Studio builds with erors unmappable character for encoding utf-8. I tried searching in google but it recognize it as a regular "fi" not "fi".
Is there any way I can fix this character?
You can avoid recognizing the fi
ligature by blacklisting it before calling baseApi.setImage
:
baseApi.setVariable(TessBaseAPI.VAR_CHAR_BLACKLIST, "fi");
To prevent Android Studio from throwing the unmappable character
error on your java code, convert your file encoding to UTF-8 by choosing "UTF-8" from the selector near the bottom right corner of the Android Studio window.