[maemo-commits] [maemo-commits] r17122 - in projects/haf/trunk/totem-pl-parser: . plparse

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Jan 12 16:43:57 EET 2009
Author: ifrade
Date: 2009-01-12 16:43:56 +0200 (Mon, 12 Jan 2009)
New Revision: 17122

Modified:
   projects/haf/trunk/totem-pl-parser/ChangeLog
   projects/haf/trunk/totem-pl-parser/plparse/totem-pl-parser-lines.c
Log:
2009-01-07 Bastien Nocera <hadess at hadess.net>

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

Modified: projects/haf/trunk/totem-pl-parser/ChangeLog
===================================================================
--- projects/haf/trunk/totem-pl-parser/ChangeLog	2009-01-12 14:43:54 UTC (rev 17121)
+++ projects/haf/trunk/totem-pl-parser/ChangeLog	2009-01-12 14:43:56 UTC (rev 17122)
@@ -1,3 +1,8 @@
+2009-01-07  Bastien Nocera  <hadess at hadess.net>
+
+	* plparse/totem-pl-parser-lines.c (totem_pl_parser_add_m3u):
+	Fix parsing of ISO-8859-1 M3U files (Closes: #553598)
+
 2009-01-05  Bastien Nocera  <hadess at hadess.net>
 
 	* plparse/totem-pl-parser.c (totem_pl_parser_parse_internal):

Modified: projects/haf/trunk/totem-pl-parser/plparse/totem-pl-parser-lines.c
===================================================================
--- projects/haf/trunk/totem-pl-parser/plparse/totem-pl-parser-lines.c	2009-01-12 14:43:54 UTC (rev 17121)
+++ projects/haf/trunk/totem-pl-parser/plparse/totem-pl-parser-lines.c	2009-01-12 14:43:56 UTC (rev 17122)
@@ -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;
 


More information about the maemo-commits mailing list