summaryrefslogtreecommitdiff
path: root/utils/utf8.h
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-17 23:44:17 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-17 23:44:17 +0000
commit41d2eca3b12de0c23f18d8f54918d4e71c1a8b56 (patch)
tree156c1240ec0f3fd246947daf6d3421e508c6b4a8 /utils/utf8.h
parentd3c890941330d6d0ea5e24a661a2d03f9369b045 (diff)
downloadnetsurf-41d2eca3b12de0c23f18d8f54918d4e71c1a8b56.tar.gz
netsurf-41d2eca3b12de0c23f18d8f54918d4e71c1a8b56.tar.bz2
Port our UTF-8 routines to parserutils (only enabled when building against Hubbub).
Sync our temporary internal copies of these functions with parserutils (which is rather better tested and fixes a number of known bugs in NetSurf's previous UTF-8 handling). Ideally, this will be the only place in NetSurf that has any dependency on parserutils, so port the amiga font code to our internal APIs. svn path=/trunk/netsurf/; revision=6550
Diffstat (limited to 'utils/utf8.h')
-rw-r--r--utils/utf8.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/utf8.h b/utils/utf8.h
index e33b07d0d..9d8ec74fa 100644
--- a/utils/utf8.h
+++ b/utils/utf8.h
@@ -23,16 +23,21 @@
#ifndef _NETSURF_UTILS_UTF8_H_
#define _NETSURF_UTILS_UTF8_H_
+#include <stdint.h>
+
typedef enum {
UTF8_CONVERT_OK,
UTF8_CONVERT_NOMEM,
UTF8_CONVERT_BADENC
} utf8_convert_ret;
-size_t utf8_to_ucs4(const char *s, size_t l);
-size_t utf8_from_ucs4(size_t c, char *s);
+uint32_t utf8_to_ucs4(const char *s, size_t l);
+size_t utf8_from_ucs4(uint32_t c, char *s);
size_t utf8_length(const char *s);
+size_t utf8_bounded_length(const char *s, size_t l);
+
+size_t utf8_char_byte_length(const char *s);
size_t utf8_prev(const char *s, size_t o);
size_t utf8_next(const char *s, size_t l, size_t o);