Index: kidna.cpp =================================================================== RCS file: /home/kde/kdelibs/kdecore/kidna.cpp,v retrieving revision 1.9.4.1 diff -u -p -r1.9.4.1 kidna.cpp --- kidna.cpp 4 Feb 2004 11:43:34 -0000 1.9.4.1 +++ kidna.cpp 3 Mar 2005 13:18:56 -0000 @@ -21,6 +21,7 @@ #include "kidna.h" +#include #include #include "ltdl.h" @@ -65,6 +66,22 @@ static void KIDNA_load_lib() KIDNA_lib_load_failed = false; // Succes } +static QStringList *KIDNA_idnDomains = 0; + +static bool idnSupportForHost(const QString &host) +{ + if (!KIDNA_idnDomains) + { + const char *kde_use_idn = getenv("KDE_USE_IDN"); + if (!kde_use_idn) + kde_use_idn = "at:ch:cn:de:dk:kr:jp:li:no:se:tw"; + KIDNA_idnDomains = new QStringList(QStringList::split(':', QString::fromLatin1(kde_use_idn).lower())); + } + + QString tld = host.mid(host.findRev('.')+1).lower(); + return KIDNA_idnDomains->contains(tld); +} + QCString KIDNA::toAsciiCString(const QString &idna) { int l = idna.length(); @@ -86,7 +103,7 @@ QCString KIDNA::toAsciiCString(const QSt KIDNA_load_lib(); } - if (KIDNA_lib_load_failed) + if (KIDNA_lib_load_failed || !idnSupportForHost(idna)) { return 0; // Can't convert } @@ -132,7 +149,7 @@ QString KIDNA::toAscii(const QString &id KIDNA_load_lib(); } - if (KIDNA_lib_load_failed) + if (KIDNA_lib_load_failed || !idnSupportForHost(idna)) { return QString::null; // Can't convert } @@ -164,7 +181,7 @@ QString KIDNA::toUnicode(const QString & KIDNA_load_lib(); } - if (KIDNA_lib_load_failed) + if (KIDNA_lib_load_failed || !idnSupportForHost(idna)) { return idna.lower(); // Return as is } Index: kssl/ksslpeerinfo.cc =================================================================== RCS file: /home/kde/kdelibs/kio/kssl/ksslpeerinfo.cc,v retrieving revision 1.44 diff -u -p -r1.44 ksslpeerinfo.cc --- kssl/ksslpeerinfo.cc 29 May 2003 16:50:21 -0000 1.44 +++ kssl/ksslpeerinfo.cc 4 Mar 2005 12:12:17 -0000 @@ -30,6 +30,7 @@ #include #include #include +#include "kidna.h" #include "ksslx509map.h" @@ -59,7 +60,7 @@ void KSSLPeerInfo::setPeerHost(QString r while(d->peerHost.endsWith(".")) d->peerHost.truncate(d->peerHost.length()-1); - d->peerHost = d->peerHost.lower(); + d->peerHost = KIDNA::toAscii(d->peerHost); } bool KSSLPeerInfo::certMatchesAddress() {