printing utf8 in glib

后端 未结 4 823
日久生厌
日久生厌 2021-02-14 19:11

Why utf8 symbols cannot be printed via glib functions?

Source code:

#include \"glib.h\"
#include 

int main() {
    g_print(\"марко\\n\");         


        
4条回答
  •  爱一瞬间的悲伤
    2021-02-14 19:21

    You need to initialize the locale's encoding by calling setlocale at your program's start.

    setlocale(LC_CTYPE, "")
    

    This is normally carried out for you if you use some initialization function like gtk_init(..) or similar.

提交回复
热议问题