File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -635,7 +635,7 @@ void QgsDataSourceUri::setEncodedUri( const QByteArray &uri )
635
635
mAuthConfigId .clear ();
636
636
637
637
QUrl url;
638
- url.setQuery ( QString::fromLatin1 ( uri ) );
638
+ url.setQuery ( QString::fromUtf8 ( uri ) );
639
639
const QUrlQuery query ( url );
640
640
641
641
const auto constQueryItems = query.queryItems ( QUrl::ComponentFormattingOption::FullyDecoded );
@@ -654,7 +654,7 @@ void QgsDataSourceUri::setEncodedUri( const QByteArray &uri )
654
654
655
655
void QgsDataSourceUri::setEncodedUri ( const QString &uri )
656
656
{
657
- setEncodedUri ( uri.toLatin1 () );
657
+ setEncodedUri ( uri.toUtf8 () );
658
658
}
659
659
660
660
QString QgsDataSourceUri::quotedTablename () const
Original file line number Diff line number Diff line change @@ -299,6 +299,19 @@ void TestQgsDataSourceUri::checkAuthParams()
299
299
QCOMPARE ( uri4.param ( QStringLiteral ( " password" ) ), QStringLiteral ( " pa%%word" ) );
300
300
QCOMPARE ( uri4.password (), QStringLiteral ( " pa%%word" ) );
301
301
302
+ // issue GH #42405
303
+ uri4.setEncodedUri ( QStringLiteral ( " dpiMode=7&url=http://localhost:8000/ows/?MAP%3D/home/bug.qgs&username=username&password=qgis%C3%A8%C3%A9" ) );
304
+ QCOMPARE ( uri4.param ( QStringLiteral ( " username" ) ), QStringLiteral ( " username" ) );
305
+ QCOMPARE ( uri4.username (), QStringLiteral ( " username" ) );
306
+ QCOMPARE ( uri4.param ( QStringLiteral ( " password" ) ), QStringLiteral ( " qgisèé" ) );
307
+ QCOMPARE ( uri4.password (), QStringLiteral ( " qgisèé" ) );
308
+
309
+ uri4.setEncodedUri ( QStringLiteral ( " dpiMode=7&url=http://localhost:8000/&username=username&password=%1" ).arg ( QString ( QUrl::toPercentEncoding ( QStringLiteral ( " 😁😂😍" ) ) ) ) );
310
+ QCOMPARE ( uri4.param ( QStringLiteral ( " username" ) ), QStringLiteral ( " username" ) );
311
+ QCOMPARE ( uri4.username (), QStringLiteral ( " username" ) );
312
+ QCOMPARE ( uri4.param ( QStringLiteral ( " password" ) ), QStringLiteral ( " 😁😂😍" ) );
313
+ QCOMPARE ( uri4.password (), QStringLiteral ( " 😁😂😍" ) );
314
+
302
315
}
303
316
304
317
You can’t perform that action at this time.
0 commit comments