#define UNI_REPLACEMENT 0xfffc
+/* Encode a character from the basic character set [0, 0xFFFF]
+ * (subset of the formal Unicode range); up to 3 bytes needed (RFC2279) */
static inline byte *
utf8_put(byte *p, uns u)
{
return p;
}
+/* Encode a value from the range [0, 0x7FFFFFFF]; up to 6 bytes needed (RFC2279) */
static inline byte *
utf8_32_put(byte *p, uns u)
{
#define UTF8_GET_NEXT if (unlikely((*p & 0xc0) != 0x80)) goto bad; u = (u << 6) | (*p++ & 0x3f)
+/* Decode a character from the basic character set [0, 0xFFFF]
+ * or return UNI_REPLACEMENT if the encoding has been corrupted */
static inline byte *
utf8_get(const byte *p, uns *uu)
{
return (byte *)p;
}
+/* Decode a value from the range [0, 0x7FFFFFFF]
+ * or return UNI_REPLACEMENT if the encoding has been corrupted */
static inline byte *
utf8_32_get(const byte *p, uns *uu)
{