From bcbbdbc4bcc5f82cef0d829fbf8beb4415c4f3c8 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Wed, 15 Jul 2015 22:59:55 +0200
Subject: degesch: fix some encoding issues
---
degesch.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/degesch.c b/degesch.c
index daed7f7..5ac89c1 100644
--- a/degesch.c
+++ b/degesch.c
@@ -2959,8 +2959,11 @@ buffer_print_backlog (struct app_context *ctx, struct buffer *buffer)
{
// The prompt can take considerable time to redraw
input_hide (&ctx->input);
- // FIXME: encoding
- print_status ("%s", buffer->name);
+
+ char *buffer_name_localized =
+ iconv_xstrdup (ctx->term_from_utf8, buffer->name, -1, NULL);
+ print_status ("%s", buffer_name_localized);
+ free (buffer_name_localized);
// That is, minus the buffer switch line and the readline prompt
int display_limit = MAX (MAX (10,
@@ -4519,21 +4522,22 @@ refresh_prompt (struct app_context *ctx)
str_init (&prompt);
make_prompt (ctx, &prompt);
str_append_c (&prompt, ' ');
+ char *localized = iconv_xstrdup (ctx->term_from_utf8, prompt.str, -1, NULL);
+ str_free (&prompt);
- // FIXME: encoding
if (have_attributes)
{
// XXX: to be completely correct, we should use tputs, but we cannot
input_set_prompt (&ctx->input, xstrdup_printf ("%c%s%c%s%c%s%c",
INPUT_START_IGNORE, ctx->attrs[ATTR_PROMPT],
INPUT_END_IGNORE,
- prompt.str,
+ localized,
INPUT_START_IGNORE, ctx->attrs[ATTR_RESET],
INPUT_END_IGNORE));
+ free (localized);
}
else
- input_set_prompt (&ctx->input, xstrdup (prompt.str));
- str_free (&prompt);
+ input_set_prompt (&ctx->input, localized);
}
// --- Helpers -----------------------------------------------------------------
--
cgit v1.2.3-70-g09d2