Mercurial > audlegacy
changeset 1575:e6fce20309f9 trunk
[svn] xspf.c needs round trip encoding conversion between locale encoding and utf8.
author | yaz |
---|---|
date | Fri, 11 Aug 2006 03:44:50 -0700 |
parents | a8a2ee855c1c |
children | 664e1b2f3e80 |
files | ChangeLog Plugins/Container/xspf/xspf.c |
diffstat | 2 files changed, 26 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Aug 11 01:48:51 2006 -0700 +++ b/ChangeLog Fri Aug 11 03:44:50 2006 -0700 @@ -1,3 +1,12 @@ +2006-08-11 08:48:51 +0000 William Pitcock <nenolod@nenolod.net> + revision [2062] + - unbork + + + Changes: Modified: + +13 -1 trunk/Plugins/Container/xspf/xspf.c + + 2006-08-11 08:32:02 +0000 William Pitcock <nenolod@nenolod.net> revision [2060] - remove unnecessary and crappy code
--- a/Plugins/Container/xspf/xspf.c Fri Aug 11 01:48:51 2006 -0700 +++ b/Plugins/Container/xspf/xspf.c Fri Aug 11 03:44:50 2006 -0700 @@ -91,12 +91,18 @@ for (i = 0; i < n->nodeNr && n->nodeTab[i]->children != NULL; i++) { char *uri = XML_GET_CONTENT(n->nodeTab[i]->children); - + gchar *locale_uri = NULL; + if (uri == NULL) continue; ++pos; - playlist_ins(uri, pos); + locale_uri = g_locale_from_utf8(uri, -1, NULL, NULL, NULL); + if(locale_uri) { + playlist_ins(locale_uri, pos); + g_free(locale_uri); + locale_uri = NULL; + } g_free(uri); } @@ -131,11 +137,15 @@ { PlaylistEntry *entry = PLAYLIST_ENTRY(node->data); xmlNodePtr track, location; + gchar *utf_filename = NULL; track = xmlNewNode(NULL, "track"); location = xmlNewNode(NULL, "location"); - xmlAddChild(location, xmlNewText(entry->filename)); + utf_filename = g_locale_to_utf8(entry->filename, -1, NULL, NULL, NULL); + if(!utf_filename) + continue; + xmlAddChild(location, xmlNewText(utf_filename)); xmlAddChild(track, location); xmlAddChild(tracklist, track); @@ -163,6 +173,10 @@ xmlAddChild(track, tmp); } } + if(utf_filename) { + g_free(utf_filename); + utf_filename = NULL; + } } xmlSaveFile(filename, doc);