Fix url getting broken on openUrl
UTF-8 byte array cannot be split in random position and assume getting valid content on resulting parts. Switched chunk size to be based on characters, encoded size will vary but don't think that should matter. Change-Id: Ic41ea16d2111b1620993b60fdbc6e739929f25d7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
e38ac423a0
commit
eda76963a8
@ -110,13 +110,17 @@ void QWaylandWindowManagerIntegration::windowmanager_quit()
|
|||||||
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
|
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
|
||||||
{
|
{
|
||||||
Q_ASSERT(isInitialized());
|
Q_ASSERT(isInitialized());
|
||||||
QByteArray data = url.toString().toUtf8();
|
QString data = url.toString();
|
||||||
|
|
||||||
static const int chunkSize = 128;
|
static const int chunkSize = 128;
|
||||||
while (!data.isEmpty()) {
|
while (!data.isEmpty()) {
|
||||||
QByteArray chunk = data.left(chunkSize);
|
QString chunk = data.left(chunkSize);
|
||||||
data = data.mid(chunkSize);
|
data = data.mid(chunkSize);
|
||||||
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
|
if (chunk.at(chunk.size() - 1).isHighSurrogate() && !data.isEmpty()) {
|
||||||
|
chunk.append(data.at(0));
|
||||||
|
data = data.mid(1);
|
||||||
|
}
|
||||||
|
open_url(!data.isEmpty(), chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user