Day 25/100 100 Days of Code

Info Hunter

I think is much more complex than it needs to be. Am I missing something that should be quite obvious? I tried fixing it myself but I was unable to get the text from the text fields. In the end, I reverted all wide strings to standard strings.

I also found out that even though a std::string variable can extract the content of a text field properly, iterating through it character by character will output "?" instead of the actual character.

This didn't work:

    std::cout << "Keyword: " << keyword << std::endl;
    std::setlocale(LC_ALL, "el_GR");
    std::cout.imbue(std::locale());

    for (auto character : keyword)
    {
        std::cout << "character: " << character << std::endl;
    }

This didn't work either:

    std::cout << "Keyword: " << keyword << std::endl;
    std::setlocale(LC_ALL, "el_GR");
    std::wcout.imbue(std::locale());

    for (wchar_t character : keyword)
    {
        std::wcout << "character: " << character << std::endl;
    }

Nope:

std::locale::global(std::locale("el_GR"));
std::wcout.imbue(std::locale());

for (wchar_t character : keyword)
{
    std::wcout << "character: " << character << std::endl;
}

I even read a post that it might be a good idea to use Objective-C as I am on a Macintosh but I decided to avoid it as I do not want to combine Objective-C and C++. I decided to download the boost-locale library to see if it could help me fix the problem. But this is a task for the next day.

I also read a great article that explains a lot about Unicode and character encoding. It might be a little old but I think the information in the article is something that everyone should know. Link:

https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/