summaryrefslogtreecommitdiff
path: root/prtype.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-15 02:01:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-10-02 22:16:08 -0700
commitd678ab80b2987ddd696519a27dad5571c379b511 (patch)
tree58edc1ba4455426cf4545bc838aadece8ca8cffd /prtype.c
parent95a96dbdc483d9dc6371f52a9e41771a64d23aed (diff)
downloadxscope-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.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/prtype.c b/prtype.c
index 9117ae0..8a16bfb 100644
--- a/prtype.c
+++ b/prtype.c
@@ -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);
}
/* ************************************************************ */