mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 15:39:04 +08:00
Remove assertions for unsupported locale settings
The latest code passed all unittests with locale de_DE.UTF-8 and has fixed the locale issues which were reported on GitHub. Therefore the assertions can be removed. Any remaining locale issue will be fixed when it is identified. To help finding such remaining isses, debug code now uses the user's locale settings instead of the default "C" locale for all executables which use TessBaseAPI. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
fb926243bd
commit
96f6fc28b8
@ -41,7 +41,6 @@
|
||||
#include <unistd.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include <clocale> // for LC_ALL, LC_CTYPE, LC_NUMERIC
|
||||
#include <cmath> // for round, M_PI
|
||||
#include <cstdint> // for int32_t
|
||||
#include <cstring> // for strcmp, strcpy
|
||||
@ -209,13 +208,16 @@ TessBaseAPI::TessBaseAPI()
|
||||
rect_height_(0),
|
||||
image_width_(0),
|
||||
image_height_(0) {
|
||||
const char *locale;
|
||||
locale = std::setlocale(LC_ALL, nullptr);
|
||||
ASSERT_HOST(!strcmp(locale, "C") || !strcmp(locale, "C.UTF-8"));
|
||||
locale = std::setlocale(LC_CTYPE, nullptr);
|
||||
ASSERT_HOST(!strcmp(locale, "C") || !strcmp(locale, "C.UTF-8"));
|
||||
locale = std::setlocale(LC_NUMERIC, nullptr);
|
||||
ASSERT_HOST(!strcmp(locale, "C") || !strcmp(locale, "C.UTF-8"));
|
||||
#if defined(DEBUG)
|
||||
// The Tesseract executables would use the "C" locale by default,
|
||||
// but other software which is linked against the Tesseract library
|
||||
// typically uses the locale from the user's environment.
|
||||
// Here the default is overridden to allow debugging of potential
|
||||
// problems caused by the locale settings.
|
||||
|
||||
// Use the current locale if building debug code.
|
||||
std::locale::global(std::locale(""));
|
||||
#endif
|
||||
}
|
||||
|
||||
TessBaseAPI::~TessBaseAPI() {
|
||||
|
Loading…
Reference in New Issue
Block a user