Unicode Charactere in der Konsole



  • Halloo ich versuhce in der Konsole Unicode auszugeben aber vergebens.
    Hier mein Kode:

    #include <iostream>
    #include <clocale>
    using namespace std;
    
    int main() {
    	setlocale(LC_ALL, "de_DE.UTF-8");
    	// SetConsoleOutputCP(CP_UTF8); // Bringt auch gar nix
    	wcout << L"Hello '\u2500'" << endl;
    	wcin.get();
    	return 0;
    }
    

    Aus gegeben wird nur Hello ' mehr nicht.

    Wo ist mein Fehler? ich find ihr nihct

    danke und viele grüße



  • probiers mal so, funktioniert zu mindest mit VC++

    #include <iostream>
    #include <io.h>      /* has to be included */
    #include <fcntl.h>   /* has to be included */
    
    int main(int param_count, char **params)
    {
       _setmode(_fileno(stdout), _O_U16TEXT); /* UTF16 support */
        // SetConsoleOutputCP(CP_UTF8); // Bringt auch gar nix
       std::wcout << L"Hello \u2500" << std::endl;
    }
    


  • Hui das klappt! supi und danke!


Anmelden zum Antworten