[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Alexandre Pereira de Oliveira <alexnewmail-bugs () yahoo ! com ! br>
Date:       2005-07-30 1:55:48
Message-ID: 1122688548.131589.30551.nullmailer () svn ! kde ! org
[Download RAW message or body]

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<KIO::StoredTransferJob*>( job )->data() );
+    KIO::StoredTransferJob* const storedJob = static_cast<KIO::StoredTransferJob*>( 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 );
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic