diff options
author | nicm <nicm> | 2015-11-12 11:10:50 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-11-12 11:10:50 +0000 |
commit | c41673f3fae397e872214880bd005cce631cf11b (patch) | |
tree | 6f07266d52a6a1b21a213de354f14a59c13d420d /cmd-load-buffer.c | |
parent | 1b86f520ea1620628e569ea833c7b13306c18a4e (diff) | |
download | rtmux-c41673f3fae397e872214880bd005cce631cf11b.tar.gz rtmux-c41673f3fae397e872214880bd005cce631cf11b.tar.bz2 rtmux-c41673f3fae397e872214880bd005cce631cf11b.zip |
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.
Diffstat (limited to 'cmd-load-buffer.c')
-rw-r--r-- | cmd-load-buffer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index 9352cbe5..40bea9b7 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -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); |