|
41 | 41 | #include <unistd.h> |
42 | 42 | #endif // _WIN32 |
43 | 43 |
|
44 | | -#include <clocale> // for LC_ALL, LC_CTYPE, LC_NUMERIC |
45 | 44 | #include <cmath> // for round, M_PI |
46 | 45 | #include <cstdint> // for int32_t |
47 | 46 | #include <cstring> // for strcmp, strcpy |
@@ -209,13 +208,16 @@ TessBaseAPI::TessBaseAPI() |
209 | 208 | rect_height_(0), |
210 | 209 | image_width_(0), |
211 | 210 | image_height_(0) { |
212 | | - const char *locale; |
213 | | - locale = std::setlocale(LC_ALL, nullptr); |
214 | | - ASSERT_HOST(!strcmp(locale, "C") || !strcmp(locale, "C.UTF-8")); |
215 | | - locale = std::setlocale(LC_CTYPE, nullptr); |
216 | | - ASSERT_HOST(!strcmp(locale, "C") || !strcmp(locale, "C.UTF-8")); |
217 | | - locale = std::setlocale(LC_NUMERIC, nullptr); |
218 | | - ASSERT_HOST(!strcmp(locale, "C") || !strcmp(locale, "C.UTF-8")); |
| 211 | +#if defined(DEBUG) |
| 212 | + // The Tesseract executables would use the "C" locale by default, |
| 213 | + // but other software which is linked against the Tesseract library |
| 214 | + // typically uses the locale from the user's environment. |
| 215 | + // Here the default is overridden to allow debugging of potential |
| 216 | + // problems caused by the locale settings. |
| 217 | + |
| 218 | + // Use the current locale if building debug code. |
| 219 | + std::locale::global(std::locale("")); |
| 220 | +#endif |
219 | 221 | } |
220 | 222 |
|
221 | 223 | TessBaseAPI::~TessBaseAPI() { |
|
0 commit comments