diff src/modplug/modplugbmp.cxx @ 1601:be8babbd772c

Convert strings to UTF-8 using str_to_utf8(). This solution is not "Correct(tm)", but since the encoding used in module files cannot be known, it's the best bet.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 05 Sep 2007 11:54:05 +0300
parents 49fe2225d236
children d6d8e3cd23c5
line wrap: on
line diff
--- a/src/modplug/modplugbmp.cxx	Wed Sep 05 07:38:21 2007 +0300
+++ b/src/modplug/modplugbmp.cxx	Wed Sep 05 11:54:05 2007 +0300
@@ -19,6 +19,7 @@
 #include "audacious/tuple.h"
 #include "audacious/tuple_formatter.h"
 #include "audacious/vfs.h"
+#include "audacious/strings.h"
 }
 
 static char* format_and_free_ti( Tuple* ti, int* length )
@@ -505,7 +506,7 @@
 {
 	CSoundFile* lSoundFile;
 	Archive* lArchive;
-	char* tmps;
+	gchar* tmps;
 	
 	//open and mmap the file
         lArchive = OpenArchive(aFilename);
@@ -546,8 +547,16 @@
 	}
 	tuple_associate_string(ti, "codec", tmps);
 	tuple_associate_string(ti, "quality", "sequenced");
-	tuple_associate_string(ti, "title", lSoundFile->GetTitle());
 	tuple_associate_int(ti, "length", lSoundFile->GetSongTime() * 1000);
+
+	/* NOTICE! FIXME? This is actually incorrect. We _cannot_ know what charset
+	 * an arbitrary module file uses .. typically it is some DOS CP-variant,
+	 * except for true Amiga modules.
+	 */
+	tmps = str_to_utf8(lSoundFile->GetTitle());
+	tuple_associate_string(ti, "title", tmps);
+	g_free(tmps);
+	
 	
 	//unload the file
 	lSoundFile->Destroy();