I've proposed this feature some years ago.
Finally got some passion to implement it.

Here is the short story:

Windows supports Unicode via UTF-16 (wchar_t),
MPD handles file names as char* strings.

To work around this several wrapper functions has been implemented:
u_open(), u_fopen(), u_stat() etc.

On most platforms they are static inline aliases to their original 
counterparts.

On Windows those expect UTF-8 encoded file name and convert it to UTF-16 
then the wchar_t function is invoked (like _wopen(), _wstat() and so on).

Stored playlist handling and music directory traversal are simple.
MPD deal with them exclusively so after adding "u_" prefix everything works.

For archive and decoder plugins that expect char* file names there is no 
Unicode support: UTF-8 names are converted to default ANSI encoding 
(those are called "code pages" in WinAPI).

Finally main() is replaced with wmain() which uses wchar_t argv.
It starts its work by converting command line to UTF-8 and calling 
mpd_main()

Some questions on patch submission:

Currently this is implemented in a bunch of feature oriented commits.
On the one side this is good because provide descriptive history.
On the other side non-ASCII file name handling might be broken between 
those because some parts still use old encoding.
I can combine these commits into more larger ones if this is preferable.

Code is available in my git repo (git://git.musicpd.org/dk/mpd.git) 
under win32-utf8 branch.

P.S. This is preliminary version for discussion. It has not been tested 
thoroughly (but works on my machine). Also I haven't tested compilation 
on Linux for possible regressions with preprocessor defines.

-- 
Denis

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to