Hi all,

I wrote simple hello world code using gettext function. My C code is:

Code:
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
        char * loc = setlocale (LC_MESSAGES, "tr_TR.UTF-8");
        if ( loc == NULL)
         {
             perror ("setlocale");
             exit (1);
          }
          bindtextdomain ("hello", "po");
          textdomain ("hello");
          printf ("%s\n", loc); 
          printf (gettext("hello world!\n"));
          exit (0);
}
My hello.po file is:

Code:
msgid ""
msgstr ""
"Project-Id-Version: hello 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-12-24 22:17+0200\n"
"PO-Revision-Date: 2010-12-24 22:17+0200\n"
"Last-Translator: artuyild>\n"
"Language-Team: Turkish\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: hello.c:16
#, c-format
msgid "hello world!\n"
msgstr "merhaba dünya!\n"
The corresponding po and compiled mo file is in the code directory:
./po/tr_TR.UTF-8/LC_MESSAGES/hello.mo

As you see, I set locale to turkish locale. In my computer, I have turkish locale files when I type locale -a I can see tr_TR.UTF-8 item.

the LANG variable is set to en_US.utf8

When I run the program, text is rendered in the terminal as:

Code:
tr_TR.UTF-8
merhaba d?nya!
So "dünya" is rendered as "d?nya". "ü" is rendered as question mark.

What can be the problem?