public
Created

  • Download Gist
localetest.c
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <stdio.h>
#include <string.h>
#include <locale.h>
 
int main (void) {
struct lconv locale_structure;
struct lconv *locale_ptr = &locale_structure;
char *a = "ä";
char *b = "b";
char *c = "c";
 
setlocale(LC_ALL, "de_DE.UTF-8");
locale_ptr=localeconv();
printf("Currency symbol: %s\n", locale_ptr->currency_symbol);
printf("%s\n", a);
printf("%d\n", strcoll(a, b));
printf("%d\n", strcoll(b, c));
}

Output on Ubuntu 10.4, gcc 4.4.3:
Currency symbol: €
ä
-1

-1

Output on OS X 10.6.4, gcc 4.2.1:
Currency symbol: Eu
ä
130
-1

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.