mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Wiki: Fix work with headwords containing the '+' sign
This commit is contained in:
parent
8ba93a6c5a
commit
109bd56f39
12
mediawiki.cc
12
mediawiki.cc
|
@ -125,7 +125,11 @@ MediaWikiWordSearchRequest::MediaWikiWordSearchRequest( wstring const & str,
|
|||
GD_DPRINTF( "request begin\n" );
|
||||
QUrl reqUrl( url + "/api.php?action=query&list=allpages&aplimit=40&format=xml" );
|
||||
|
||||
Qt4x5::Url::addQueryItem( reqUrl, "apfrom", gd::toQString( str ) );
|
||||
#if IS_QT_5
|
||||
Qt4x5::Url::addQueryItem( reqUrl, "apfrom", gd::toQString( str ).replace( '+', "%2B" ) );
|
||||
#else
|
||||
reqUrl.addEncodedQueryItem( "apfrom", QUrl::toPercentEncoding( gd::toQString( str ) ) );
|
||||
#endif
|
||||
|
||||
netReply = mgr.get( QNetworkRequest( reqUrl ) );
|
||||
|
||||
|
@ -266,7 +270,11 @@ void MediaWikiArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
|||
|
||||
QUrl reqUrl( url + "/api.php?action=parse&prop=text|revid&format=xml&redirects" );
|
||||
|
||||
Qt4x5::Url::addQueryItem( reqUrl, "page", gd::toQString( str ) );
|
||||
#if IS_QT_5
|
||||
Qt4x5::Url::addQueryItem( reqUrl, "page", gd::toQString( str ).replace( '+', "%2B" ) );
|
||||
#else
|
||||
reqUrl.addEncodedQueryItem( "page", QUrl::toPercentEncoding( gd::toQString( str ) ) );
|
||||
#endif
|
||||
|
||||
QNetworkReply * netReply = mgr.get( QNetworkRequest( reqUrl ) );
|
||||
|
||||
|
|
Loading…
Reference in a new issue