summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/setrunelocale.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-10-10 22:56:18 +0000
committertjr <tjr@FreeBSD.org>2002-10-10 22:56:18 +0000
commitd62abf19a31226cab0b997316f5d332a67f9c6b8 (patch)
tree818571da6c27befa8ace080e6465f3a6668ac52e /lib/libc/locale/setrunelocale.c
parentc6135e53fb158af2985432f68c7a060590faf606 (diff)
downloadFreeBSD-src-d62abf19a31226cab0b997316f5d332a67f9c6b8.zip
FreeBSD-src-d62abf19a31226cab0b997316f5d332a67f9c6b8.tar.gz
Add a UTF-8 encoding method, which will eventually replace the antique
"UTF2" method. Although UTF-8 and the old UTF2 encoding are compatible for 16-bit characters, the new UTF-8 implementation is much more strict about rejecting malformed input and also handles the full 31 bit range of characters.
Diffstat (limited to 'lib/libc/locale/setrunelocale.c')
-rw-r--r--lib/libc/locale/setrunelocale.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c
index 042a06c..9cfe8d6 100644
--- a/lib/libc/locale/setrunelocale.c
+++ b/lib/libc/locale/setrunelocale.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
extern int _none_init(_RuneLocale *);
extern int _UTF2_init(_RuneLocale *);
+extern int _UTF8_init(_RuneLocale *);
extern int _EUC_init(_RuneLocale *);
extern int _BIG5_init(_RuneLocale *);
extern int _MSKanji_init(_RuneLocale *);
@@ -130,6 +131,8 @@ setrunelocale(char *encoding)
ret = _none_init(rl);
else if (strcmp(rl->encoding, "UTF2") == 0)
ret = _UTF2_init(rl);
+ else if (strcmp(rl->encoding, "UTF-8") == 0)
+ ret = _UTF8_init(rl);
else if (strcmp(rl->encoding, "EUC") == 0)
ret = _EUC_init(rl);
else if (strcmp(rl->encoding, "BIG5") == 0)
OpenPOWER on IntegriCloud