cutf-8

Having problems printing åäö (├Ñ ├à | ├ñ ├ä | ├ ├û)


I can't print the swedish letters åäö.

#include <stdio.h>
#include <stdlib.h>

int main(void){
   printf("å Å | ä Ä | ö Ö");

   return 0;
}

The output I get is:

├Ñ ├à | ├ñ ├ä | ├ ├û

I don't understand what is wrong. I've searched google and stackoverflow, but nothing to be found. Maybe there is something wrong with UTF-8?

Other information that might be usefull:

I'm using Windows 10 and atom.

SOLUTION

Go to:

System language settings -> Administrative language settings -> Change system locale...

Now check the following box:

[Beta: Use Unicode UTF-8 for worldwide language support]

This fixed my problem and I am now able to use UTF-8 characters.


Solution

  • The Windows command window (terminal, console, whatever you call it) does support UTF-8 since several years, at least with Windows 7 based on my experiences. You need to set the code page:

    mode con cp select=65001
    

    Additionally you can set the output code page programmatically:

    SetConsoleOutputCP(CP_UTF8);