c - wcscoll returns different result than expected -


consider code:

#include <wchar.h> #include <locale.h> #include <stdio.h>  int main(void) {     setlocale(lc_all, "pl_pl.utf-8");     printf("%d\n", wcscoll(l"ą", l"b"));     return 0; } 

the output is

158 

but i'd expect -1, since ą before b in polish alphabet. why did return 158? , if not in way, how can 1 compare words alphabetically?

i tried in linux machine , 1 output, positive yours.

then edited supported locales @ /etc/locale.gen, uncommented pl_pl.utf-8 (not enabled default), run sudo locale-gen , gives -4, negative, expected.

the conclusion system configuration, is, not support selected locale.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -