changeset 1579:d60e3dbe1a48 trunk

[svn] - better handling for file name which can't be represented correctly in current locale encoding.
author yaz
date Sat, 12 Aug 2006 20:00:08 -0700
parents 063fde7e5100
children dae6b30c0148
files ChangeLog Plugins/Container/xspf/xspf.c
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Aug 12 16:46:09 2006 -0700
+++ b/ChangeLog	Sat Aug 12 20:00:08 2006 -0700
@@ -1,3 +1,12 @@
+2006-08-12 23:46:09 +0000  George Averill <nhjm449@gmail.com>
+  revision [2071]
+  - Show the filename if there's no track_name
+  
+
+  Changes:        Modified:
+  +12 -6          trunk/Plugins/General/notify/notify.c  
+
+
 2006-08-12 01:41:53 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2068]
   - installing Container plugins might help!
--- a/Plugins/Container/xspf/xspf.c	Sat Aug 12 16:46:09 2006 -0700
+++ b/Plugins/Container/xspf/xspf.c	Sat Aug 12 20:00:08 2006 -0700
@@ -98,6 +98,10 @@
 
 		++pos;
 		locale_uri = g_locale_from_utf8(uri, -1, NULL, NULL, NULL);
+		if(!locale_uri){
+			/* try ISO-8859-1 for last resort */
+			locale_uri = g_convert(uri, -1, "ISO-8859-1", "UTF-8", NULL, NULL, NULL);
+		}
 		if(locale_uri) {
 			playlist_ins(locale_uri, pos);
 			g_free(locale_uri);
@@ -142,9 +146,12 @@
 		track = xmlNewNode(NULL, "track");
 		location = xmlNewNode(NULL, "location");
 
-		utf_filename  = g_locale_to_utf8(entry->filename, -1, NULL, NULL, NULL);
-		if(!utf_filename)
-			continue;
+		/* try locale encoding first */
+		utf_filename = g_locale_to_utf8(entry->filename, -1, NULL, NULL, NULL);
+		if (!utf_filename) {
+			/* if above fails, try to guess */
+			utf_filename = str_to_utf8(entry->filename);
+		}
 		xmlAddChild(location, xmlNewText(utf_filename));
 		xmlAddChild(track, location);
 		xmlAddChild(tracklist, track);