Detecting locale from unicode string in c++
c++, unicode
Solution
Here is how you do it with Glib::ustring :
using Glib::ustring;
ustring x("सहस"); // hindi string
bool is_hindi = false;
for (ustring::iterator i = x.begin(); i != x.end(); i ++)
if (*i >= 0x0900 && *i <= 0x097f)
is_hindi = true;
Problem
I have a string and I want to check if the content is in English or Hindi(My local language). I figured out that the unicode range for hindi character is from U0900-U097F. What is the simplest way to find if the string has any characters in this range? I can use std::string or Glib::ustring depending on whichever is convenient.