Re: Bug in collation functions?

2015-11-02 Thread Corinna Vinschen
On Oct 31 13:13, Ken Brown wrote: > On 10/30/2015 10:07 AM, Ken Brown wrote: > >Hi Corinna, > > > >On 10/30/2015 8:03 AM, Corinna Vinschen wrote: > >>On Oct 29 18:21, Ken Brown wrote: > >>>The fallback I had in mind is to return the shorter string if they have > >>>different lengths and otherwise t

Re: Bug in collation functions?

2015-10-31 Thread Ken Brown
On 10/30/2015 10:07 AM, Ken Brown wrote: Hi Corinna, On 10/30/2015 8:03 AM, Corinna Vinschen wrote: On Oct 29 18:21, Ken Brown wrote: The fallback I had in mind is to return the shorter string if they have different lengths and otherwise to revert to wcscmp. > I had a longer look into this

Re: Bug in collation functions?

2015-10-30 Thread Ken Brown
On 10/30/2015 3:14 PM, Corinna Vinschen wrote: On Oct 30 10:07, Ken Brown wrote: What about the other issue I raised: Should setlocale return null to indicate an error if it's given an invalid locale name like en_DE.UTF-8? Huh. Interesting. You're runing Windows10, right? Yes After some

Re: Bug in collation functions?

2015-10-30 Thread Corinna Vinschen
On Oct 30 10:07, Ken Brown wrote: > Hi Corinna, > > On 10/30/2015 8:03 AM, Corinna Vinschen wrote: > >On Oct 29 18:21, Ken Brown wrote: > >>The fallback I had in mind is to return the shorter string if they have > >>different lengths and otherwise to revert to wcscmp. > > > >I had a longer look in

Re: Bug in collation functions?

2015-10-30 Thread Ken Brown
Hi Corinna, On 10/30/2015 8:03 AM, Corinna Vinschen wrote: On Oct 29 18:21, Ken Brown wrote: The fallback I had in mind is to return the shorter string if they have different lengths and otherwise to revert to wcscmp. > I had a longer look into this suggestion and the below code and it took m

Re: Bug in collation functions?

2015-10-30 Thread Corinna Vinschen
Hi Ken, On Oct 29 18:21, Ken Brown wrote: > On 10/29/2015 5:49 PM, Ken Brown wrote: > >On 10/29/2015 2:42 PM, Ken Brown wrote: > >>On 10/29/2015 12:51 PM, Eric Blake wrote: > >>>Careful. POSIX is proposing some wording that say that normal locales > >>>should always implement a fallback of last r

Re: Bug in collation functions?

2015-10-29 Thread Ken Brown
On 10/29/2015 5:49 PM, Ken Brown wrote: On 10/29/2015 2:42 PM, Ken Brown wrote: On 10/29/2015 12:51 PM, Eric Blake wrote: On 10/29/2015 10:13 AM, Ken Brown wrote: Never mind. My test case was flawed, because it didn't check for the possibility that wcscoll might return 0. Here's a revised d

Re: Bug in collation functions?

2015-10-29 Thread Ken Brown
On 10/29/2015 2:42 PM, Ken Brown wrote: On 10/29/2015 12:51 PM, Eric Blake wrote: On 10/29/2015 10:13 AM, Ken Brown wrote: Never mind. My test case was flawed, because it didn't check for the possibility that wcscoll might return 0. Here's a revised definition of the "compare" function: voi

Re: Bug in collation functions?

2015-10-29 Thread Ken Brown
On 10/29/2015 12:51 PM, Eric Blake wrote: On 10/29/2015 10:13 AM, Ken Brown wrote: Never mind. My test case was flawed, because it didn't check for the possibility that wcscoll might return 0. Here's a revised definition of the "compare" function: void compare (const wchar_t *a, const wchar_

Re: Bug in collation functions?

2015-10-29 Thread Eric Blake
On 10/29/2015 10:13 AM, Ken Brown wrote: > Never mind. My test case was flawed, because it didn't check for the > possibility that wcscoll might return 0. Here's a revised definition of > the "compare" function: > > void > compare (const wchar_t *a, const wchar_t *b, const char *loc) > { > se

Re: Bug in collation functions?

2015-10-29 Thread Ken Brown
On 10/29/2015 11:45 AM, Ken Brown wrote: On 10/29/2015 11:35 AM, Corinna Vinschen wrote: On Oct 29 08:59, Ken Brown wrote: On 10/29/2015 4:30 AM, Corinna Vinschen wrote: On Oct 29 08:50, Corinna Vinschen wrote: On Oct 28 21:58, Eric Blake wrote: On 10/28/2015 04:14 PM, Ken Brown wrote: It's

Re: Bug in collation functions?

2015-10-29 Thread Eric Blake
On 10/29/2015 09:35 AM, Corinna Vinschen wrote: >>> Right now Cygwin calls CompareStringW with dwCmpFlags set to 0, but there >>> are flags like NORM_IGNORENONSPACE, NORM_IGNORESYMBOLS. I'm open to a >>> discussion how to change the settings to more closely resemble the rules >>> on Linux. >>> >>

Re: Bug in collation functions?

2015-10-29 Thread Ken Brown
On 10/29/2015 11:35 AM, Corinna Vinschen wrote: On Oct 29 08:59, Ken Brown wrote: On 10/29/2015 4:30 AM, Corinna Vinschen wrote: On Oct 29 08:50, Corinna Vinschen wrote: On Oct 28 21:58, Eric Blake wrote: On 10/28/2015 04:14 PM, Ken Brown wrote: It's my understanding that collation is suppos

Re: Bug in collation functions?

2015-10-29 Thread Corinna Vinschen
On Oct 29 08:59, Ken Brown wrote: > On 10/29/2015 4:30 AM, Corinna Vinschen wrote: > >On Oct 29 08:50, Corinna Vinschen wrote: > >>On Oct 28 21:58, Eric Blake wrote: > >>>On 10/28/2015 04:14 PM, Ken Brown wrote: > It's my understanding that collation is supposed to take whitespace and > pun

Re: Bug in collation functions?

2015-10-29 Thread Ken Brown
On 10/29/2015 4:30 AM, Corinna Vinschen wrote: On Oct 29 08:50, Corinna Vinschen wrote: On Oct 28 21:58, Eric Blake wrote: On 10/28/2015 04:14 PM, Ken Brown wrote: It's my understanding that collation is supposed to take whitespace and punctuation into account in the POSIX locale but not in ot

Re: Bug in collation functions?

2015-10-29 Thread Corinna Vinschen
On Oct 29 08:50, Corinna Vinschen wrote: > On Oct 28 21:58, Eric Blake wrote: > > On 10/28/2015 04:14 PM, Ken Brown wrote: > > > It's my understanding that collation is supposed to take whitespace and > > > punctuation into account in the POSIX locale but not in other locales. > > > > Not quite ri

Re: Bug in collation functions?

2015-10-29 Thread Corinna Vinschen
On Oct 28 21:58, Eric Blake wrote: > On 10/28/2015 04:14 PM, Ken Brown wrote: > > It's my understanding that collation is supposed to take whitespace and > > punctuation into account in the POSIX locale but not in other locales. > > Not quite right. It is up to the locale definition whether whites

Re: Bug in collation functions?

2015-10-28 Thread Eric Blake
On 10/28/2015 04:14 PM, Ken Brown wrote: > It's my understanding that collation is supposed to take whitespace and > punctuation into account in the POSIX locale but not in other locales. Not quite right. It is up to the locale definition whether whitespace affects collation. But you are correct

Bug in collation functions?

2015-10-28 Thread Ken Brown
It's my understanding that collation is supposed to take whitespace and punctuation into account in the POSIX locale but not in other locales. This doesn't seem to be the case on Cygwin. Here's a test case using wcscoll, but the same problem occurs with strcoll. $ cat wcscoll_test.c #include