Fix case-related ISO country code issue#2934
Conversation
|
CHANGELOG: Server: ISO country codes can now be supplied in upper or lower case |
| QStringList vstrLocParts = qLocale.name().split ( "_" ); | ||
|
|
||
| if ( vstrLocParts.size() >= 2 && vstrLocParts.at ( 1 ).toLower() == sTwoLetterCode ) | ||
| if ( vstrLocParts.size() >= 2 && vstrLocParts.at ( 1 ).toLower() == sTwoLetterCode.toLower() ) |
There was a problem hiding this comment.
https://doc.qt.io/qt-6/qlocale.html#codeToTerritory
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
From what I can make out, I'd be expecting upper case?
I'm wondering if line 1450 above will work.
There was a problem hiding this comment.
Best I can tell, the QT6 code handles the case conversion so it will accept upper/lower/mixed. See https://codebrowser.dev/qt6/qtbase/src/corelib/text/qlocale.cpp.html line 157.
For QT < 6, my contribution here was to fix an immediate bug. I added exactly 10 characters to the codebase. Since the original ISO contribution forced a toLower(), I simply balanced it to solve the problem.
I have not walked up the QT code tree to see what the QT5 data for locales looks like, so unless someone wants to do that, I think it is safer to normalize the strings (upper or lower) as done here.
Short description of changes
Fixes issue relating to ISO country codes only working if provided in lower case. Now support any case combination.
CHANGELOG: ISO country codes can now be supplied in upper or lower case
Context: Fixes an issue?
Fixes issue #2933
Does this change need documentation? What needs to be documented and how?
Probably not as I think the general expectation is that the country code should not be case sensitive anyway.
Status of this Pull Request
What is missing until this pull request can be merged?
Checklist