diff options
author | 2016-04-26 07:33:36 +0000 | |
---|---|---|
committer | 2016-04-26 07:33:36 +0000 | |
commit | eea1329743bcfd8ac93260970d41874d1ce3a5eb (patch) | |
tree | 8bc421eb2fcf5c1956b2d043b4cf86e730cbbdfb | |
parent | more systrace goes away (diff) | |
download | wireguard-openbsd-eea1329743bcfd8ac93260970d41874d1ce3a5eb.tar.xz wireguard-openbsd-eea1329743bcfd8ac93260970d41874d1ce3a5eb.zip |
Log wcwidth() and mbtowc() failure to make it easier to debug a Unicode
codepoint not appearing.
-rw-r--r-- | usr.bin/tmux/utf8.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/tmux/utf8.c b/usr.bin/tmux/utf8.c index 9c9aa223cb2..7c6845f0e93 100644 --- a/usr.bin/tmux/utf8.c +++ b/usr.bin/tmux/utf8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utf8.c,v 1.29 2016/03/02 15:36:03 nicm Exp $ */ +/* $OpenBSD: utf8.c,v 1.30 2016/04/26 07:33:36 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -18,6 +18,7 @@ #include <sys/types.h> +#include <errno.h> #include <stdlib.h> #include <string.h> #include <vis.h> @@ -116,8 +117,10 @@ utf8_width(wchar_t wc) int width; width = wcwidth(wc); - if (width < 0 || width > 0xff) + if (width < 0 || width > 0xff) { + log_debug("Unicode %04x, wcwidth() %d", wc, width); return (-1); + } return (width); } @@ -127,6 +130,8 @@ utf8_combine(const struct utf8_data *ud, wchar_t *wc) { switch (mbtowc(wc, ud->data, ud->size)) { case -1: + log_debug("UTF-8 %.*s, mbtowc() %d", (int)ud->size, ud->data, + errno); mbtowc(NULL, NULL, MB_CUR_MAX); return (UTF8_ERROR); case 0: |