diff --git a/src/articleview.cc b/src/articleview.cc index 522afee6..9bec108b 100644 --- a/src/articleview.cc +++ b/src/articleview.cc @@ -486,10 +486,33 @@ void ArticleView::openLink( QUrl const & url, QUrl const & ref, printf( "clicked %s\n", url.toString().toLocal8Bit().data() ); if ( url.scheme() == "bword" ) - showDefinition( ( url.host().startsWith( "xn--" ) ? - QUrl::fromPunycode( url.host().toLatin1() ) : - url.host() ) + url.path(), + { + QString host = url.host(); + + // If the host has punycode in its domains, decode it + + QStringList domains = host.split( '.' ); + + bool hadPunycode = false; + + for( QStringList::iterator i = domains.begin(); i != domains.end(); ++i ) + { + if ( i->startsWith( "xn--" ) ) + { + *i = QUrl::fromPunycode( i->toLatin1() ); + hadPunycode = true; + } + } + + if ( hadPunycode ) + { + // Join back the result + host = domains.join( "." ); + } + + showDefinition( host + url.path(), getGroup( ref ), scrollTo, contexts ); + } else if ( url.scheme() == "gdlookup" ) // Plain html links inherit gdlookup scheme {