From: Bruno Haible <bruno@clisp.org>
Date: Sun, 10 Jan 2010 22:11:54 +0000 (+0100)
Subject: unistr/u*-strcoll: Try harder to distinguish different strings.
X-Git-Tag: v0.1~4863
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=4590e3da98b250317145c92090a8caf41c92c925;p=gnulib.git

unistr/u*-strcoll: Try harder to distinguish different strings.
---

diff --git a/ChangeLog b/ChangeLog
index f1f514a129..6d90821562 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+	unistr/u*-strcoll: Try harder to distinguish different strings.
+	* lib/unistr/u-strcoll.h (FUNC): When sl1 and sl2 are the same,
+	compare s1 and s2 to see if they are different.
+
 2010-01-10  Bruno Haible  <bruno@clisp.org>
 
 	unistr/u*-stpncpy: Fix the return value.
diff --git a/lib/unistr/u-strcoll.h b/lib/unistr/u-strcoll.h
index e1dc713819..9ec5c60170 100644
--- a/lib/unistr/u-strcoll.h
+++ b/lib/unistr/u-strcoll.h
@@ -41,6 +41,12 @@ FUNC (const UNIT *s1, const UNIT *s2)
               /* strcoll succeeded.  */
               free (sl1);
               free (sl2);
+              /* The conversion to locale encoding can do transliteration or
+                 map some characters to question marks.  Therefore sl1 and sl2
+                 may be equal when s1 and s2 were in fact different.  Return a
+                 nonzero result in this case.  */
+              if (result == 0)
+                result = U_STRCMP (s1, s2);
             }
           else
             {