[mythtv] MythVideo and UTF-8 (again...)

Lutz Mändle lmaendle at gmx.net
Fri Sep 10 13:13:01 EDT 2004


MythVideo 0.16 has the same problems with utf-8 filenames as 0.15.1, 
after investigating in the source code, I've made some changes in 
main.cpp, which solving the problems for me.
In the attachment is the patch, can someone try, whether it works on a 
non utf-8 system?

-- 
Lutz Mändle         Internet: lmaendle at gmx.net
Berlin/Germany

-------------- next part --------------
diff -Naur ./orig/main.cpp ./patched/main.cpp
--- ./orig/main.cpp	2004-08-22 20:16:32.000000000 +0200
+++ ./patched/main.cpp	2004-09-10 18:53:56.000000000 +0200
@@ -368,7 +368,8 @@
             QString name = QString::fromUtf8(query.value(0).toString());
             if (name != QString::null)
             {
-                if ((iter = video_files.find(name)) != video_files.end())
+//                if ((iter = video_files.find(name)) != video_files.end())
+                if ((iter = video_files.find(name.utf8())) != video_files.end())
                     video_files.remove(iter);
                 else
                     video_files[name] = kDatabase;
@@ -408,9 +409,10 @@
             QString name(iter.key());
             name.replace(quote_regex, "\"\"");
  
-            QString querystr;
-            querystr.sprintf("DELETE FROM videometadata WHERE "
-                                       "filename=\"%s\"", name.ascii());
+	    QString querystr = QString("DELETE FROM videometadata WHERE filename = \"%1\" ;") .arg(name.utf8());
+//            QString querystr;
+//            querystr.sprintf("DELETE FROM videometadata WHERE "
+//                                       "filename=\"%s\"", name.ascii());
             query.exec(querystr);
         }
 
@@ -485,7 +487,8 @@
             }
         }
         
-        QString filename = fi->absFilePath();
+//        QString filename = fi->absFilePath();
+        QString filename = fi->absFilePath().utf8();
         if (fi->isDir())
             BuildFileList(db, filename, video_files, imageExtensions);
         else


More information about the mythtv-dev mailing list