summaryrefslogtreecommitdiff
path: root/src/PlaylistSave.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-10-18 10:05:26 +0200
committerMax Kellermann <max@musicpd.org>2017-10-18 10:05:26 +0200
commit9703a401c5ac3f679503b845805fe24db22c458c (patch)
treee0e481f9dd315c1b8ed065c7a024c4d9a740bb24 /src/PlaylistSave.cxx
parent753a2aa4622b2a116b510ae1ea41b3898c425955 (diff)
Playlist{File,Save}: always use UTF-8 in playlists on Windows
Turns out that using CP_ACP is a lousy idea, because only very few Unicode characters can be represented by it. Instead, switch to UTF-8 (which every sane person on other operating system already uses). Closes #102
Diffstat (limited to 'src/PlaylistSave.cxx')
-rw-r--r--src/PlaylistSave.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx
index 88d8cbe74..d3ec30bb2 100644
--- a/src/PlaylistSave.cxx
+++ b/src/PlaylistSave.cxx
@@ -28,7 +28,6 @@
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
-#include "fs/NarrowPath.hxx"
#include "fs/io/FileOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "util/UriUtil.hxx"
@@ -38,7 +37,14 @@
static void
playlist_print_path(BufferedOutputStream &os, const Path path)
{
- os.Format("%s\n", NarrowPath(path).c_str());
+#ifdef _UNICODE
+ /* on Windows, playlists always contain UTF-8, because its
+ "narrow" charset (i.e. CP_ACP) is incapable of storing all
+ Unicode paths */
+ os.Format("%s\n", path.ToUTF8().c_str());
+#else
+ os.Format("%s\n", path.c_str());
+#endif
}
void