If we know the terminal outside tmux is not UTF-8, replace UTF-8 in

error messages and whatnot with underscores the same as we do when we
draw UTF-8 characters as part of the screen.
This commit is contained in:
nicm
2015-11-12 11:10:50 +00:00
parent 1b86f520ea
commit c41673f3fa
4 changed files with 67 additions and 4 deletions

View File

@ -133,7 +133,7 @@ void
cmd_load_buffer_callback(struct client *c, int closed, void *data)
{
const char *bufname = data;
char *pdata, *cause;
char *pdata, *cause, *saved;
size_t psize;
if (!closed)
@ -154,6 +154,11 @@ cmd_load_buffer_callback(struct client *c, int closed, void *data)
if (paste_set(pdata, psize, bufname, &cause) != 0) {
/* No context so can't use server_client_msg_error. */
if (~c->flags & CLIENT_UTF8) {
saved = cause;
cause = utf8_sanitize(saved);
free(saved);
}
evbuffer_add_printf(c->stderr_data, "%s", cause);
server_push_stderr(c);
free(pdata);