summaryrefslogtreecommitdiff
path: root/src/htscharset.h
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2013-05-25 16:48:12 +0000
committerXavier Roche <xroche@users.noreply.github.com>2013-05-25 16:48:12 +0000
commit1c7d4a612505e1b01165723c1a2c1abd732165be (patch)
tree8b5819a08b029d617add9f5311f492c8b2d25657 /src/htscharset.h
parent3e59977b2736dbe9a3c801882ec4f03a43af07b5 (diff)
Added hts_convertUCS4StringToUTF8() and hts_convertUTF8StringToUCS4()
Diffstat (limited to 'src/htscharset.h')
-rw-r--r--src/htscharset.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/htscharset.h b/src/htscharset.h
index f95213c..04bb6c1 100644
--- a/src/htscharset.h
+++ b/src/htscharset.h
@@ -41,6 +41,9 @@ Please visit our Website: http://www.httrack.com
#include <windows.h>
#endif
+/** UCS4 type. **/
+typedef unsigned int hts_UCS4;
+
/** Leading character (ASCII or leading UTF-8 sequence) **/
#define HTS_IS_LEADING_UTF8(C) ((unsigned char)(C) < 0x80 || (unsigned char)(C) >= 0xc0)
@@ -109,6 +112,22 @@ extern size_t hts_copyStringUTF8(char *dest, const char *src,
extern size_t hts_appendStringUTF8(char *dest, const char *src,
size_t nBytes);
+/**
+ * Convert an UTF-8 string into an Unicode string (0-terminated).
+ **/
+extern hts_UCS4* hts_convertUTF8StringToUCS4(const char *s, size_t size,
+ size_t *nChars);
+
+/**
+ * Convert an Unicode string into an UTF-8 string.
+ **/
+extern char *hts_convertUCS4StringToUTF8(const hts_UCS4 *s, size_t nChars);
+
+/**
+ * Return the length (in characters) of an UCS4 string terminated by 0.
+ **/
+extern size_t hts_stringLengthUCS4(const hts_UCS4 *s);
+
/* WIN32 specific. */
#ifdef _WIN32