1

I tried

print ("السلام عليكم\n");

it outputs

?????? ?????

After looking at the generated c code

...
g_print ("السلام عليكم\n");
...

it appears that they're using g_print() which it is not doing that same as printf() in C which works perfectly fine with Arabic.

So, is there anyway to print arabic text in Vala?

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
Naheel
  • 497
  • 3
  • 13

1 Answers1

2

Just add this to the start of your code:

Intl.setlocale (LocaleCategory.ALL, "");

By leaving the second parameter an empty string you're loading the LOCALE that the current user has set (which is likely to be a UTF-8 based one on modern Linux systems).

Windows is a different story here ...

See also:

Community
  • 1
  • 1
Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
  • 2
    Or from Vala 0.28 you can use `Intl.setlocale ();` because `LocaleCategory.ALL, ""` are now the default arguments. – AlThomas Nov 21 '16 at 11:14