Reputation: 5869
I am using the following to output the full name of a month in Greek.
setlocale(LC_TIME, 'el_GR');
strftime("%B");
This works, except the output string is ISO-8859-7 (greek code page), which is a problem since I need a UTF-8 string. I could put this through iconv to convert it, but I was wondering if there was a way to do that without resorting to an extra function.
Could you somehow tell strftime to output a UTF-8 string in this case?
Upvotes: 10
Views: 2597
Reputation: 11
Just a sidenote to ZZ Coder's answer:
if setlocale(LC_TIME, 'el_GR.UTF-8');
does not work in linux, check your enabled locales by running locale -a
from the shell.
If you don't see el_GR.UTF-8
there, open /etc/locale.gen
and uncomment the corresponding line.
Then run locale-gen
and you should be ok.
Upvotes: 1