diff options
author | Igor Vagulin <hidden@address.private.email> | 2008-10-09 04:48:00 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-10-09 04:52:39 -0700 |
commit | 3456e2de5bf90207d8149a842bb12c3f9bdd218f (patch) | |
tree | b6b77d2fe6e087ca3e2f797721854a9eaec72765 | |
parent | dec65409ba20c653efafbd57d6f74b6d376a9f92 (diff) | |
download | mpd-3456e2de5bf90207d8149a842bb12c3f9bdd218f.tar.gz mpd-3456e2de5bf90207d8149a842bb12c3f9bdd218f.tar.xz mpd-3456e2de5bf90207d8149a842bb12c3f9bdd218f.zip |
song: fix create-db with fs locale differ from latin1 and utf8
> From: Igor Vagulin <hidden@address.private.email>
> 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 <normalperson@yhbt.net>
-rw-r--r-- | src/song.c | 6 |
1 files changed, 4 insertions, 2 deletions
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), |