Skip to content

Instantly share code, notes, and snippets.

@earl
Created July 13, 2010 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save earl/474596 to your computer and use it in GitHub Desktop.
Save earl/474596 to your computer and use it in GitHub Desktop.
// a simple hack to check if wcscoll(P) really does locale-sensitive collation
#include<wchar.h>
#include<stdio.h>
#include<locale.h>
int main(int argc, char **argv) {
setlocale(LC_ALL, argv[1]);
printf("%d\n", wcscoll(L"z", L"ö"));
return 0;
}
/*
$ gcc wcscoll.c
$ ./a.out sv_SE.UTF-8
-3
$ ./a.out de_DE.UTF-8
11
$
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment