totem-pl-parser r276 - in trunk: . plparse



Author: hadess
Date: Wed Jan  7 18:20:51 2009
New Revision: 276
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=276&view=rev

Log:
2009-01-07  Bastien Nocera  <hadess hadess net>

	* plparse/totem-pl-parser-lines.c (totem_pl_parser_add_m3u):
	Fix parsing of ISO-8859-1 M3U files (Closes: #553598)



Modified:
   trunk/ChangeLog
   trunk/plparse/totem-pl-parser-lines.c

Modified: trunk/plparse/totem-pl-parser-lines.c
==============================================================================
--- trunk/plparse/totem-pl-parser-lines.c	(original)
+++ trunk/plparse/totem-pl-parser-lines.c	Wed Jan  7 18:20:51 2009
@@ -366,6 +366,17 @@
 		return retval;
 	}
 
+	/* Try to use ISO-8859-1 if we don't have valid UTF-8,
+	 * try to parse anyway if it's not ISO-8859-1 */
+	if (g_utf8_validate (contents, -1, NULL) == FALSE) {
+		char *fixed;
+		fixed = g_convert (contents, -1, "UTF-8", "ISO8859-1", NULL, NULL, NULL);
+		if (fixed != NULL) {
+			g_free (contents);
+			contents = fixed;
+		}
+	}
+
 	/* is non-NULL if there's an EXTINF on a preceding line */
 	extinfo = NULL;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]