X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Ftools-common.c;h=a94466cec785c5a05423b21113a5ef99d9ce8934;hb=44029221e8423f1ca93470952542a0517a208d42;hp=63fce4e0f1f26be7cac83170a480cf525cb25e7e;hpb=bd79a960f596574e9c2ea59347f9afac469ef532;p=platform%2Fupstream%2Flibxkbcommon.git diff --git a/tools/tools-common.c b/tools/tools-common.c index 63fce4e..a94466c 100644 --- a/tools/tools-common.c +++ b/tools/tools-common.c @@ -32,6 +32,7 @@ #include "config.h" +#include #include #include #include @@ -99,7 +100,17 @@ tools_print_keycode_state(struct xkb_state *state, xkb_compose_state_get_utf8(compose_state, s, sizeof(s)); else xkb_state_key_get_utf8(state, keycode, s, sizeof(s)); - printf("unicode [ %s ] ", s); + /* HACK: escape single control characters from C0 set using the + * Unicode codepoint convention. Ideally we would like to escape + * any non-printable character in the string. + */ + if (!*s) { + printf("unicode [ ] "); + } else if (strlen(s) == 1 && (*s <= 0x1F || *s == 0x7F)) { + printf("unicode [ U+%04hX ] ", *s); + } else { + printf("unicode [ %s ] ", s); + } layout = xkb_state_key_get_layout(state, keycode); printf("layout [ %s (%d) ] ",