pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 09/18] i18n: New function uc_name().


From: Ben Pfaff
Subject: [PATCH 09/18] i18n: New function uc_name().
Date: Sat, 19 Mar 2011 17:09:55 -0700

---
 src/libpspp/i18n.c |    9 +++++++++
 src/libpspp/i18n.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/libpspp/i18n.c b/src/libpspp/i18n.c
index cb15572..13a46a5 100644
--- a/src/libpspp/i18n.c
+++ b/src/libpspp/i18n.c
@@ -377,3 +377,12 @@ get_system_decimal (void)
   return radix_char;
 }
 
+const char *
+uc_name (ucs4_t uc, char buffer[16])
+{
+  if (uc >= 0x20 && uc < 0x7f)
+    snprintf (buffer, 16, "`%c'", uc);
+  else
+    snprintf (buffer, 16, "U+%04X", uc);
+  return buffer;
+}
diff --git a/src/libpspp/i18n.h b/src/libpspp/i18n.h
index e016eab..2f55a69 100644
--- a/src/libpspp/i18n.h
+++ b/src/libpspp/i18n.h
@@ -18,6 +18,7 @@
 #define I18N_H
 
 #include <stdbool.h>
+#include <unistr.h>
 
 void  i18n_done (void);
 void  i18n_init (void);
@@ -49,5 +50,6 @@ void set_default_encoding (const char *enc);
 
 bool set_encoding_from_locale (const char *loc);
 
+const char *uc_name (ucs4_t uc, char buffer[16]);
 
 #endif /* i18n.h */
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]