-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.2.0
-
Component/s: Querying
-
None
-
Environment:windows 7, language zh_CN.UTF-8
My local language is zh_CN.UTF-8.
When I do query using sort(),the return values may be wrong.
As you know, the sort() use compareElementValues() do strings' compare.
In compareElementValues():
...
case String:
/* todo: a utf sort order version one day... */
...
This function use memcmp() do compare, so it can return right result with UTF8 string ,but not zh_CN.UTF-8.
May be we can use strcoll() instead of memcmp() here, the it can support multilanguage sort.
strcoll can compare two strings using locale language:
int strcoll ( const char * str1, const char * str2 );
Compare two strings using locale
Compares the C string str1 to the C string str2, both interpreted appropiately according to the LC_COLLATE category of the current locale.
This function starts comparing the first character of each string. If they are equal to each other continues with the following pair until the characters differ or until a null-character signaling the end of a string is reached.
For more informationg, see http://www.cplusplus.com/reference/clibrary/cstring/strcoll/ and http://www.cplusplus.com/reference/clibrary/clocale/setlocale/