Search code examples
mysqlcutf-8locale

C application special characters Äöü not showing up correctly in MySQL and terminal


I'm trying to set up my C application so it supports special characters such as ÄÖÜ. However, in the terminal and in my MySQL database they do not show up and are replaced with an " ?". I'm using UTF-8 for the entire db and also set the locale in my c application with

setlocale(LC_ALL, "de_DE.UTF-8");

What can I do to make my application support these characters?

If I set them manually in phpmyadmin, all seems to work.


Solution

  • In your terminal, while in mysql, you can run this command:

    SET NAMES UTF8
    

    Then everything should display properly in your terminal. You might need to do the same in your C application. That will set the encoding for the session.