summaryrefslogtreecommitdiff
path: root/plugins/m3u
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-01-12 20:33:24 +0100
committerGravatar waker <wakeroid@gmail.com>2012-01-12 20:33:24 +0100
commit60dd90151e1cf38521e28c2d9970320f87699c10 (patch)
tree591dc6e7593d4c749257e8113c5f68c869b696f8 /plugins/m3u
parent8d0c04a98d2b46af7a2f850c97452d7e2e7332d0 (diff)
m3u: automatic charset detection/conversion
Diffstat (limited to 'plugins/m3u')
-rw-r--r--plugins/m3u/m3u.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/m3u/m3u.c b/plugins/m3u/m3u.c
index b333cdbc..030507e2 100644
--- a/plugins/m3u/m3u.c
+++ b/plugins/m3u/m3u.c
@@ -125,6 +125,25 @@ load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab
memcpy (nm, p, n);
nm[n] = 0;
+ if (title[0]) {
+ const char *cs = deadbeef->junk_detect_charset (title);
+ if (cs) {
+ char tmp[2048];
+ if (deadbeef->junk_iconv (title, strlen (title), tmp, sizeof (tmp), cs, "utf-8") >= 0) {
+ strcpy (title, tmp);
+ }
+ }
+ }
+ if (artist[0]) {
+ const char *cs = deadbeef->junk_detect_charset (artist);
+ if (cs) {
+ char tmp[2048];
+ if (deadbeef->junk_iconv (artist, strlen (artist), tmp, sizeof (tmp), cs, "utf-8") >= 0) {
+ strcpy (artist, tmp);
+ }
+ }
+ }
+
DB_playItem_t *it = NULL;
if (strrchr (nm, '/')) {
trace ("pl_insert_m3u: adding file %s\n", nm);