From: Ben Pfaff Date: Sun, 12 Dec 2010 04:58:32 +0000 (-0800) Subject: i18n: New function uc_name(). X-Git-Tag: v0.7.7~25 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d89701ab597b810da249ff0e4e42423e869df66;p=pspp-builds.git i18n: New function uc_name(). --- diff --git a/src/libpspp/i18n.c b/src/libpspp/i18n.c index cb155723..13a46a53 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 e016eab4..2f55a690 100644 --- a/src/libpspp/i18n.h +++ b/src/libpspp/i18n.h @@ -18,6 +18,7 @@ #define I18N_H #include +#include 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 */