[Development] Hardcoded strings and qstricmp comparison

Andy Shaw andy.shaw at qt.io
Wed Nov 14 09:34:50 CET 2018


Hi!

In connection to a support case I have been working on it was brought to my attention that there may be some problems that are connected to using qstricmp and other functions that are expecting latin1 strings for one reason or another. The reason that this might be a problem is because we are encoding our source code as UTF-8 and there is a theoretical problem that due to this that we are not protecting the strings correctly to ensure that they are treated as latin1 when we explicitly write them internally. It could be that reality is that this will never be a problem, and if that is the case then please give me the background on that so I can pass this on too.

For user code I get that we can just say that they should do something like:

  qstricmp(str, QLatin1String("a").latin1());

and that would be ensuring it is correctly seen as a latin1 encoded string. If this is how it should be done, then shouldn’t we change our usage of it in the Qt code as well to do the same thing? Or am I missing something?

Kind Regards,
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20181114/c793ee2e/attachment.html>


More information about the Development mailing list