Skip to content

resolving the missing accents in the ocr window. #3

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

OCR plugin for ksnip.

See ksnip README for install and usage instruction [here](https://github.com/ksnip/ksnip#plugins).
See ksnip README for install and usage instruction [here](https://github.com/ksnip/ksnip#plugins).



## About Fork
Fork created to address the issue of missing accents in the OCR output.
6 changes: 3 additions & 3 deletions src/OcrWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ QString OcrWrapper::recognize(const QPixmap &pixmap, const QString &dataPath) co

QString OcrWrapper::recognizeInner(const QPixmap &pixmap, char * dataPath) const
{
if (mTessApi->Init(dataPath, "eng") == 0)
if (mTessApi->Init(dataPath, "por") == 0)
{
auto pix = makePixFromPixmap(pixmap);
mTessApi->SetImage(pix);
Expand All @@ -50,9 +50,9 @@ QString OcrWrapper::recognizeInner(const QPixmap &pixmap, char * dataPath) const

pixDestroy(&pix);

return QString::fromLatin1(recognizedText.data());
return QString::fromUtf8(recognizedText.data());

} else {
} else {
qCritical("Failed to initialize Tesseract");
return {};
}
Expand Down