Friday, May 8, 2009

c program for unicode in linux

/*Program to check unicode support for gujurati language */


#include < stdio.h >
#include < locale.h >

int main()
{
char *locale;

printf("without using unicode for gujrati language\n");
printf("%ls\n", L"નમસતે રામ ,મેરા દેસ મહાન");
printf("\n");
printf("using unicode for gujrati language\n");

locale=setlocale(LC_ALL, "gu_IN.utf8");
if (!locale) {
fprintf(stderr, "Can't set the specified locale! "
"Check LANG, LC_CTYPE, LC_ALL.\n");
return 1;
}

printf("\n");
printf("%ls\n", L"નમસતે રામ ,મેરા દેસ મહાન");
printf("\n");
return 0;
}


#gcc -o unicode unicode.c
#./unicode
without using unicode for gujrati language

using unicode for gujrati language

નમસતે રામ ,મેરા દેસ મહાન

No comments: