[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: KDE/kdelibs/kioslave/http
From: David Faure <faure () kde ! org>
Date: 2007-02-09 17:27:17
Message-ID: 200702091827.18847.faure () kde ! org
[Download RAW message or body]
On Friday 09 February 2007, Nickolai Shaforostoff wrote:
> SVN commit 631979 by shaforo:
>
> decode auth message properly, for sites like lib.homelinux.org
>
> M +10 -2 http.cc
>
>
> --- trunk/KDE/kdelibs/kioslave/http/http.cc #631978:631979
> @@ -4981,13 +4981,21 @@
> while( (*p == ' ') || (*p == ',') || (*p == '\t') ) { p++; }
> if ( strncasecmp( p, "realm=", 6 ) == 0 )
> {
> + //for sites like lib.homelinux.org
> + QTextCodec* oldCodec=QTextCodec::codecForCStrings();
> + if (KGlobal::locale()->language().contains("ru"))
> + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("CP1251"));
> +
> p += 6;
> if (*p == '"') p++;
> while( p[i] && p[i] != '"' ) i++;
> if( b )
> - m_strProxyRealm = QString::fromLatin1( p, i );
> + m_strProxyRealm = QString::fromAscii( p, i );
> else
> - m_strRealm = QString::fromLatin1( p, i );
> + m_strRealm = QString::fromAscii( p, i );
> +
> + QTextCodec::setCodecForCStrings(oldCodec);
This is really convoluted. Why not do
QTextCodec* codec = QTextCodec::codecForCStrings(); // or the one from KLocale
if (KGlobal::locale()->language().contains("ru"))
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("CP1251"));
and then use codec->toUnicode(p,i)?
Sounds better than setting+unsetting the codec for cstrings...
--
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic