[sword-devel] better UTF-sensitive sort

Karl Kleinpaste karl at kleinpaste.org
Tue Jan 12 09:12:34 MST 2016


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20160112/59c4f0c4/attachment.html>


More information about the sword-devel mailing list