summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-03-23 14:23:34 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-03-25 17:04:37 +0100
commit9e01a9a5d174a274091cef011e55a18ee3460cdc (patch)
treecba9a0fd201f318606cb6bcbcce876cf69d93d4b /src
parent460d7c87803b47b28434cc44d7d027b3a9c48dac (diff)
Apply the East-Saskatchewan exception to zone-fragment lengths to ICU
The exception was previously limited to Android, but I now find that ICU has the same over-long names; it seems likely that's where Android gets them. Also update the link to the theory page from the TZ DB, as it now has an official home on www.iana.org. Task-number: QTBUG-99747 Pick-to: 6.3 6.2 Change-Id: I9af67426d15609dfaf5f335405ceb1218fcf40ff Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/time/qtimezoneprivate.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/time/qtimezoneprivate.cpp b/src/corelib/time/qtimezoneprivate.cpp
index e3f392230a..d1f6330559 100644
--- a/src/corelib/time/qtimezoneprivate.cpp
+++ b/src/corelib/time/qtimezoneprivate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Copyright (C) 2013 John Layt <jlayt@kde.org>
** Contact: https://www.qt.io/licensing/
**
@@ -582,16 +582,20 @@ QTimeZone::OffsetData QTimeZonePrivate::toOffsetData(const QTimeZonePrivate::Dat
bool QTimeZonePrivate::isValidId(const QByteArray &ianaId)
{
/*
- Main rules for defining TZ/IANA names as per ftp://ftp.iana.org/tz/code/Theory
+ Main rules for defining TZ/IANA names, as per
+ https://www.iana.org/time-zones/repository/theory.html, are:
1. Use only valid POSIX file name components
2. Within a file name component, use only ASCII letters, `.', `-' and `_'.
3. Do not use digits (except in a [+-]\d+ suffix, when used).
4. A file name component must not exceed 14 characters or start with `-'
+
However, the rules are really guidelines - a later one says
- Do not change established names if they only marginally violate the
above rules.
We may, therefore, need to be a bit slack in our check here, if we hit
- legitimate exceptions in real time-zone databases.
+ legitimate exceptions in real time-zone databases. In particular, ICU
+ includes some non-standard names with some components > 14 characters
+ long; so does Android, possibly deriving them from ICU.
In particular, aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid
so we need to accept digits, ':', and '+'; aliases typically have the form
@@ -618,8 +622,8 @@ bool QTimeZonePrivate::isValidId(const QByteArray &ianaId)
// Somewhat slack hand-rolled version:
const int MinSectionLength = 1;
-#ifdef Q_OS_ANDROID
- // Android has its own naming of zones.
+#if defined(Q_OS_ANDROID) || QT_CONFIG(icu)
+ // Android has its own naming of zones. It may well come from ICU.
// "Canada/East-Saskatchewan" has a 17-character second component.
const int MaxSectionLength = 17;
#else