From kde-commits Sat Jul 30 01:55:48 2005 From: Alexandre Pereira de Oliveira Date: Sat, 30 Jul 2005 01:55:48 +0000 To: kde-commits Subject: extragear/multimedia/amarok/src Message-Id: <1122688548.131589.30551.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112268856200912 SVN commit 440168 by aoliveira: Fix UTF-8 handling in podcasts CCMAIL: sitter.harald@gmx.net M +2 -0 playlistbrowser.cpp M +8 -2 playlistbrowseritem.cpp --- trunk/extragear/multimedia/amarok/src/playlistbrowser.cpp #440167:440168 @@ -828,6 +828,7 @@ { QFile file( podcastBrowserCache() ); QTextStream stream( &file ); + stream.setEncoding( QTextStream::UnicodeUTF8 ); QDomDocument d; QDomElement e; @@ -851,6 +852,7 @@ QDomDocument xml; QFile xmlFile( xmlLocation ); QTextStream stream( &xmlFile ); + stream.setEncoding( QTextStream::UnicodeUTF8 ); if( !xmlFile.open( IO_ReadOnly ) || !xml.setContent( stream.read() ) ) continue; --- trunk/extragear/multimedia/amarok/src/playlistbrowseritem.cpp #440167:440168 @@ -1066,8 +1066,14 @@ return; } - QString xml = QString( static_cast( job )->data() ); + KIO::StoredTransferJob* const storedJob = static_cast( job ); + QString xml = QString( storedJob->data() ); + // FIXME: Get a better way to detect this + if ( xml.contains( "encoding=\"UTF-8\"", false ) ) { + xml = QString::fromUtf8( storedJob->data().data(), storedJob->data().size() ); + } + QDomDocument d; if( !d.setContent( xml ) ) @@ -1084,7 +1090,7 @@ setXml( d.namedItem("rss").namedItem("channel") ); ///BEGIN Cache the xml - QFile file( amaroK::saveLocation( "podcasts/" ) + m_cache ); + QFile file( amaroK::saveLocation( "podcasts/" ) + m_cache ); QTextStream stream( &file );