diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-15 02:01:41 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-10-02 22:16:08 -0700 |
commit | d678ab80b2987ddd696519a27dad5571c379b511 (patch) | |
tree | 58edc1ba4455426cf4545bc838aadece8ca8cffd /prtype.c | |
parent | 95a96dbdc483d9dc6371f52a9e41771a64d23aed (diff) | |
download | xscope-d678ab80b2987ddd696519a27dad5571c379b511.tar.gz |
Print UTF8_STRING properties as text if locale uses UTF-8 charset
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Diffstat (limited to 'prtype.c')
-rw-r--r-- | prtype.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -1054,9 +1054,22 @@ PrintPropertyValues(const unsigned char *buf, uint32_t type /* atom */, uint8_t unit, uint32_t num, const char *name) { if (type == 31 /* string */) - PrintString8(buf, num * unit, name); - else - PrintBytes(buf, num * unit, name); + return PrintString8(buf, num * unit, name); + else { + const char *typename = FindAtomName(type); + + if (typename) { + if (strcmp(typename, "UTF8_STRING") == 0) { + if (IsUTF8locale) + return PrintString8(buf, num * unit, name); + else + return PrintBytes(buf, num * unit, name); + } + } + } + + /* When all else fails, print raw bytes */ + return PrintBytes(buf, num * unit, name); } /* ************************************************************ */ |