replace broken chars with '?' and make the "Unable to convert..." message

go away.

from MAINTAINER (Tobias Ulmer <tobias@tmux.org>)

"go ahead" bernd@
This commit is contained in:
jasper 2007-01-11 17:36:40 +00:00
parent 8c504328f4
commit 357ebe12cc
4 changed files with 81 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.4 2006/12/16 12:22:32 espie Exp $
# $OpenBSD: Makefile,v 1.5 2007/01/11 17:36:40 jasper Exp $
# mips64 architecture does not support trampoline code yet
NOT_FOR_ARCHS= mips64
@ -6,6 +6,7 @@ NOT_FOR_ARCHS= mips64
COMMENT= "curses based frontend for mpd"
DISTNAME= ncmpc-0.11.1
PKGNAME= ${DISTNAME}p0
CATEGORIES= audio
HOMEPAGE= http://hem.bredband.net/kaw/ncmpc/

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-src_mpdclient_c,v 1.1 2007/01/11 17:36:40 jasper Exp $
--- src/mpdclient.c.orig Sun Jan 23 18:37:42 2005
+++ src/mpdclient.c Tue Jan 2 16:21:06 2007
@@ -846,10 +846,9 @@
{
mpdclient_filelist_t *filelist;
mpd_InfoEntity *entity;
- 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 +870,9 @@
if( mpdclient_finish_command(c) )
{
- g_free(path_utf8);
return mpdclient_filelist_free(filelist);
}
- g_free(path_utf8);
filelist->path = g_strdup(path);
filelist->updated = TRUE;

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_screen_file_c,v 1.1 2007/01/11 17:36:40 jasper Exp $
--- src/screen_file.c.orig Sun Jan 23 18:37:42 2005
+++ src/screen_file.c Tue Jan 2 16:19:47 2007
@@ -255,7 +255,7 @@
{
/* enter sub */
mpd_Directory *dir = entity->info.directory;
- 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 +566,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;
}

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-src_support_c,v 1.1 2007/01/11 17:36:40 jasper Exp $
--- src/support.c.orig Sun Jan 23 18:37:41 2005
+++ src/support.c Tue Jan 2 16:16:16 2007
@@ -149,6 +149,7 @@
gchar *str;
gsize rb, wb;
GError *error;
+ const char *charset;
if( noconvert )
return g_strdup(utf8str);
@@ -156,15 +157,11 @@
rb = 0; /* bytes read */
wb = 0; /* bytes written */
error = NULL;
- str=g_locale_from_utf8(utf8str,
- strlen(utf8str),
- &wb, &rb,
- &error);
+ g_get_charset(&charset);
+ str = g_convert_with_fallback(
+ utf8str, -1, charset, "UTF-8", "?", &rb, &wb, &error);
if( error )
{
- const char *charset;
-
- g_get_charset(&charset);
screen_status_printf(_("Error: Unable to convert characters to %s"),
charset);
D("utf8_to_locale(): %s\n", error->message);