[sword-devel] better UTF-sensitive sort

DM Smith dmsmith at crosswire.org
Tue Jan 12 09:32:48 MST 2016


Is ICU4C out of the question? It has support for collation. See: http://site.icu-project.org/design/collation/v2 <http://site.icu-project.org/design/collation/v2>

> On Jan 12, 2016, at 11:12 AM, Karl Kleinpaste <karl at kleinpaste.org> wrote:
> 
> To produce Xiphos' module trees (sidebar, mod.mgr, adv.search), I sort by language using qsort+strcmp. This was recently pointed out as being poor for UTF-8 strings, and I replaced strcmp with strcoll. This works fine in Linux. Unfortunately, the Win32 version of strcoll believes in UTF-16, even when the locale is set to xx_YY.UTF-8, and this mis-sorts everything, e.g. Čeština lands in the middle of the "A" region.  Are there any suggestions for a suitable comparator I can use with qsort, that won't make me do a huge amount of transcoding everything to UTF-16 when the strings and the app are otherwise entirely driven in UTF-8?
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20160112/9748236e/attachment.html>


More information about the sword-devel mailing list