diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-15 22:59:55 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-15 22:59:55 +0200 |
commit | bcbbdbc4bcc5f82cef0d829fbf8beb4415c4f3c8 (patch) | |
tree | 64f2abc97300a3b89cd1dd2a515472661cb12f23 | |
parent | b257340ad2a6ef1f2eed4a2e075e6decba772013 (diff) | |
download | xK-bcbbdbc4bcc5f82cef0d829fbf8beb4415c4f3c8.tar.gz xK-bcbbdbc4bcc5f82cef0d829fbf8beb4415c4f3c8.tar.xz xK-bcbbdbc4bcc5f82cef0d829fbf8beb4415c4f3c8.zip |
degesch: fix some encoding issues
-rw-r--r-- | degesch.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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 ----------------------------------------------------------------- |