[Development] Utf8 local aware compare

Bubke Marco Marco.Bubke at digia.com
Thu Sep 11 13:23:16 CEST 2014


Hi

Okay, first the context. I want to write locale aware compare collations for a local database which is saving the text in UTF-8. So converting the text always with QString::fromUtf8 is a little bit expensive. Under Unix strcoll would work but for windows there is no UTF-8 collation. One idea around that problem is to convert per character to UTF-16 and than compare it. Is there some internal API where I could do the conversion per character(not per byte)?

Anyway, best would be:

QCollator<http://qt-project.org/doc/qt-5/qcollator.html#QCollator>::compare<http://qt-project.org/doc/qt-5/qcollator.html#compare>(const char *utf8String1, const char *utf8String2, size_t size1=-1, size_t size2=-1) const

Thank you, Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140911/34c7093b/attachment.html>


More information about the Development mailing list