Skip to main content

Command Palette

Search for a command to run...

Day 25/100 100 Days of Code

Info Hunter

Published
2 min read
Day 25/100 100 Days of Code
C

AKA Chris, is a software developer from Athens, Greece. He started programming with basic when he was very young. He lost interest in programming during school years but after an unsuccessful career in audio, he decided focus on what he really loves which is technology.

He loves working with older languages like C and wants to start programming electronics and microcontrollers because he wants to get into embedded systems programming.

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/

100 Days of Code

Part 25 of 50

100 days of code is a good initiative to go into hard mode and spend more time in programming. These 100 days will be focused on completing projects and research.

Up next

Day 26/100 100 Days of Code

Info Hunter