Skip to content

Commit

Permalink
Merge pull request #1649 from stweil/locale
Browse files Browse the repository at this point in the history
Test for correct locale settings
  • Loading branch information
zdenop authored Jun 8, 2018
2 parents 89730e1 + 3292484 commit e7c1e07
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#endif // _WIN32

#include <algorithm>
#include <clocale>
#include <fstream>
#include <iostream>
#include <iterator>
Expand Down Expand Up @@ -185,7 +186,15 @@ TessBaseAPI::TessBaseAPI()
rect_width_(0),
rect_height_(0),
image_width_(0),
image_height_(0) {}
image_height_(0) {
const char *locale;
locale = std::setlocale(LC_ALL, nullptr);
ASSERT_HOST(!strcmp(locale, "C"));
locale = std::setlocale(LC_CTYPE, nullptr);
ASSERT_HOST(!strcmp(locale, "C"));
locale = std::setlocale(LC_NUMERIC, nullptr);
ASSERT_HOST(!strcmp(locale, "C"));
}

TessBaseAPI::~TessBaseAPI() {
End();
Expand Down

0 comments on commit e7c1e07

Please sign in to comment.