Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Creator 5.5 and C++ wchar_t type

Qt Creator 5.5 and C++ wchar_t type

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sdjskrS Offline
    sdjskrS Offline
    sdjskr
    wrote on last edited by sdjskr
    #1

    Hi, I'm a newbie to Qt.

    I have some trouble in showing a Korean character with wchar_t type in Qt Project's console.

    My code is simple like this.

    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        wchar_t letter = L'가';
    
        wcout << letter << endl;
        return a.exec();
    }
    

    The problem is that it shows nothing but a cursor in the console window.
    Actually, I found the value resides in memory, only not showing it.

    By the way, when I go with a English letter, it shows normally.

    wchar_t = L"a";
    

    In MSVC, I solved this by using C++ locale.

    wcout.imbue(locale("korean"))
    
    

    but in Qt there is no imbue for wcout.

    Does Qt even support C++11 fully?
    or, do you guys have any other solutions for this?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Maybe setCodecForLocal would help.

      You can use C++11 without any problem even C++14 if your compiler supports it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved