From 3456e2de5bf90207d8149a842bb12c3f9bdd218f Mon Sep 17 00:00:00 2001 From: Igor Vagulin Date: Thu, 9 Oct 2008 04:48:00 -0700 Subject: song: fix create-db with fs locale differ from latin1 and utf8 > From: Igor Vagulin > To: warren.dukes@gmail.com > Date: Wed, 08 Oct 2008 03:09:15 +0400 > CC: jat@spatialrift.net, normalperson@yhbt.net > Subject: mpd bug: create-db with fs locale differ from latin1 and utf8 > > Hi Warren, > > I discover a bug in mpd from trunk. I make a patch and decide to send to > maintainer in hope it may be useful. > > Bug triggers folowing steps: > - Set filesystem_charset to something not latin1 and utf8.(For me > fs-charset was KOI8-R) > - Put some music in music directory with non ascii characters in path. > - run mpg with --create-db option, so mpd will try to find all music > files in music directory. > > Result: music files with non latin characters in path don't added to db. > > Bug happen because function newSong don't translate path into fs charset > before send it to plugin tagDupFuntion. On my machine tagDupFunction > can't find file when it was. Small patch in attach fix problem. Signed-off-by: Eric Wong --- src/song.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/song.c') diff --git a/src/song.c b/src/song.c index c9301386d..ddc3bc4bd 100644 --- a/src/song.c +++ b/src/song.c @@ -62,8 +62,10 @@ Song *newSong(const char *url, Directory * parentDir) InputPlugin *plugin; unsigned int next = 0; char path_max_tmp[MPD_PATH_MAX]; - char *abs_path = rmp2amp_r(path_max_tmp, - get_song_url(path_max_tmp, song)); + char abs_path[MPD_PATH_MAX]; + + utf8_to_fs_charset(abs_path, get_song_url(path_max_tmp, song)); + rmp2amp_r(abs_path, abs_path); while (!song->tag && (plugin = isMusic(abs_path, &(song->mtime), -- cgit v1.2.3