When i test the code mentioned above, it works in Samsung Galaxy S4, Sony Experia M4 Aqua. But fails in Samsung Galaxy S3 and Samsung Tablet SM-T113 so far… Isn’t it strange?
The example chars: ö, ç, ğ, İ, ü, ş
std::setlocale(LC_ALL, "Turkish.UTF-8");
std::mbstate_t mb{};
int len;
for(const char* p = &this->arrWords[sayKelime][0], *end = p + this->arrWords[sayKelime].size(); p < end; p += len ) {
len = std::mbrlen(p, end - p, &mb);
if(len < 0) break;
this->hElemanlar.emplace_back(p, p + len);
}
log("locale ayarlandi 1: %s", setlocale(LC_ALL, ""));
log("locale ayarlandi 2: %s", setlocale(LC_ALL, NULL));
log("locale ayarlandi 3: %s", setlocale(LC_ALL, "tr_TR"));
log("locale ayarlandi 4: %s", setlocale(LC_ALL, "tr_TR.ISO-8859-9"));
log("locale ayarlandi 5: %s", setlocale(LC_ALL, "Turkish"));
log("locale ayarlandi 6: %s", setlocale(LC_ALL, "Turkish.UTF-8"));
log("locale ayarlandi 7: %s", setlocale(LC_ALL, "TURKISH"));
log("locale ayarlandi 8: %s", setlocale(LC_ALL, "Turkey"));
These logs all print null
Edit: And what i realized is that for some devices the code below works, for some not:
setlocale(LC_ALL, "");
log("locale ayarlandi 1: %s", setlocale(LC_ALL, ""));
setlocale(LC_ALL, NULL);
log("locale ayarlandi 2: %s", setlocale(LC_ALL, NULL));
If successful, log is “C”.