On Tue, Jan 02, 2007 at 09:28:06AM +0100, Jasper Lievisse Adriaanse wrote:
> [...]
Turns out that ncmpc converts the directory name to ascii and later back
to utf8 to 'ls' a directory.
Tobias
Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/ncmpc/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile 16 Dec 2006 12:22:32 -0000 1.4
+++ Makefile 2 Jan 2007 14:33:55 -0000
@@ -6,6 +6,7 @@
COMMENT= "curses based frontend for mpd"
DISTNAME= ncmpc-0.11.1
+PKGNAME= ${DISTNAME}p0
CATEGORIES= audio
HOMEPAGE= http://hem.bredband.net/kaw/ncmpc/
Index: patches/patch-src_mpdclient_c
===================================================================
RCS file: patches/patch-src_mpdclient_c
diff -N patches/patch-src_mpdclient_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_mpdclient_c 2 Jan 2007 14:33:55 -0000
@@ -0,0 +1,30 @@
+--- src/mpdclient.c.orig Tue Jan 2 14:33:11 2007
++++ src/mpdclient.c Tue Jan 2 14:43:01 2007
+@@ -846,10 +846,10 @@
+ {
+ mpdclient_filelist_t *filelist;
+ mpd_InfoEntity *entity;
+- gchar *path_utf8 = locale_to_utf8(path);
++ /*gchar *path_utf8 = locale_to_utf8(path); */
+
+- D("mpdclient_filelist_get(%s)\n", path);
+- mpd_sendLsInfoCommand(c->connection, path_utf8);
++ D("mpdclient_filelist_get(%s)\n", utf8_to_locale(path));
++ mpd_sendLsInfoCommand(c->connection, path);
+ filelist = g_malloc0(sizeof(mpdclient_filelist_t));
+ if( path && path[0] && strcmp(path, "/") )
+ {
+@@ -871,11 +871,11 @@
+
+ if( mpdclient_finish_command(c) )
+ {
+- g_free(path_utf8);
++ /* g_free(path_utf8); */
+ return mpdclient_filelist_free(filelist);
+ }
+
+- g_free(path_utf8);
++ /* g_free(path_utf8); */
+ filelist->path = g_strdup(path);
+ filelist->updated = TRUE;
+
Index: patches/patch-src_screen_file_c
===================================================================
RCS file: patches/patch-src_screen_file_c
diff -N patches/patch-src_screen_file_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_screen_file_c 2 Jan 2007 14:33:55 -0000
@@ -0,0 +1,21 @@
+--- src/screen_file.c.orig Sun Jan 23 18:37:42 2005
++++ src/screen_file.c Tue Jan 2 15:24:20 2007
+@@ -255,7 +255,8 @@
+ {
+ /* enter sub */
+ mpd_Directory *dir = entity->info.directory;
+- path = utf8_to_locale(dir->path);
++ /* path = utf8_to_locale(dir->path); */
++ path = g_strdup(dir->path);
+ /* save current list window state */
+ push_lw_state();
+ list_window_reset(lw);
+@@ -566,7 +567,7 @@
+ static char *
+ browse_title(char *str, size_t size)
+ {
+- g_snprintf(str, size, _("Browse: %s"), basename(filelist->path));
++ g_snprintf(str, size, _("Browse: %s"),
utf8_to_locale(basename(filelist->path)));
+ return str;
+ }
+
Index: patches/patch-src_support_c
===================================================================
RCS file: patches/patch-src_support_c
diff -N patches/patch-src_support_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_support_c 2 Jan 2007 14:33:55 -0000
@@ -0,0 +1,15 @@
+--- src/support.c.orig Sun Jan 23 18:37:41 2005
++++ src/support.c Tue Jan 2 01:53:34 2007
+@@ -156,10 +156,8 @@
+ rb = 0; /* bytes read */
+ wb = 0; /* bytes written */
+ error = NULL;
+- str=g_locale_from_utf8(utf8str,
+- strlen(utf8str),
+- &wb, &rb,
+- &error);
++ str = g_convert_with_fallback(
++ utf8str, -1, "ASCII", "UTF-8", "?", &rb, &wb, &error);
+ if( error )
+ {
+ const char *charset;