Why utf8 symbols cannot be printed via glib functions?
Source code:
#include \"glib.h\"
#include
int main() {
g_print(\"марко\\n\");
Usually it is not recommended to use anything other than ASCII inside text files. You should use tools like gettext in order to translate words from different languages. If this is out of the question then you should store your string in UTF-8 in your code.
Try printing this one (it's the hexadecimal representation of your string):
char hex_marco[]={0xD0, 0xBC, 0xD0, 0xB0, 0xD1, 0x80, 0xD0, 0xBA, 0xD0, 0xBE, 0};
This works for me in printf (cannot test here with glib):
#include
char hex_marco[]={0xD0, 0xBC, 0xD0, 0xB0, 0xD1, 0x80, 0xD0, 0xBA, 0xD0, 0xBE, 0};
int main(void)
{
printf("%s\n",hex_marco);
return 0;
}
Redirect the output to file and see it as UTF-8.
Hope it helps.