Back to index

glibc  2.9
tst-codeset.c File Reference
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.


int main (void)

Function Documentation

int main ( void  )

Definition at line 28 of file tst-codeset.c.

  char *s;
  int result = 0;

  unsetenv ("LANGUAGE");
  unsetenv ("OUTPUT_CHARSET");
  setlocale (LC_ALL, "de_DE.ISO-8859-1");
  textdomain ("codeset");
  bindtextdomain ("codeset", OBJPFX "domaindir");

  /* Here we expect output in ISO-8859-1.  */
  s = gettext ("cheese");
  if (strcmp (s, "K\344se"))
      printf ("call 1 returned: %s\n", s);
      result = 1;

  bind_textdomain_codeset ("codeset", "UTF-8");

  /* Here we expect output in UTF-8.  */
  s = gettext ("cheese");
  if (strcmp (s, "K\303\244se"))
      printf ("call 2 returned: %s\n", s);
      result = 1;

  return result;

Here is the call graph for this function: