[Top][All Lists]
[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
- [PATCH 00/18] rewrite PSPP lexer, Ben Pfaff, 2011/03/19
- [PATCH 01/18] data-reader: Remove unreachable "return" statements., Ben Pfaff, 2011/03/19
- [PATCH 07/18] str: New functions for checking for and removing string suffixes., Ben Pfaff, 2011/03/19
- [PATCH 10/18] i18n: New function recode_string_len()., Ben Pfaff, 2011/03/19
- [PATCH 09/18] i18n: New function uc_name().,
Ben Pfaff <=
- [PATCH 14/18] encoding-guesser: New library to guess the encoding of a text file., Ben Pfaff, 2011/03/19
- [PATCH 04/18] output: New function text_item_create_nocopy()., Ben Pfaff, 2011/03/19
- [PATCH 05/18] str: New function ss_realloc()., Ben Pfaff, 2011/03/19
- [PATCH 13/18] i18n: New functions and data structure for obtaining encoding info., Ben Pfaff, 2011/03/19
- [PATCH 06/18] str: Rename ss_chomp() to ss_chomp_byte(), ds_chomp() to ds_chomp_byte()., Ben Pfaff, 2011/03/19
- [PATCH 02/18] file-name: Do not make output files line-buffered in fn_open()., Ben Pfaff, 2011/03/19
- [PATCH 12/18] identifier: Rename token_type_to_string() and make a new version., Ben Pfaff, 2011/03/19
- [PATCH 08/18] hash-functions: New function hash_case_bytes()., Ben Pfaff, 2011/03/19
- [PATCH 11/18] i18n: New functions for truncating strings in an arbitrary encoding., Ben Pfaff, 2011/03/19
- [PATCH 17/18] scan: New library for high-level PSPP syntax lexical analysis., Ben Pfaff, 2011/03/19