Logo Search packages:      
Sourcecode: sofia-sip version File versions

utf8.h File Reference

Detailed Description

Encoding/Decoding Functions for UCS Transformation Format UTF-8.

UTF-8 encoding codes the ISO 10646 (Unicode, UCS2 and UCS4) characters as variable length (1 - 6 bytes) strings of 8-bit characters.

Pekka Pessi <pekka.pessi@nokia.com>
Created: Tue Apr 21 15:32:38 1998 pessi
See also:
RFC 2279, "UTF-8, a transformation format of ISO 10646", F. Yergeau. January 1998.

Definition in file utf8.h.

#include <sofia-sip/su_types.h>

Go to the source code of this file.


#define IS_UCS4_1(x)   ((ucs4)(x) <= 0x7fu)
#define IS_UCS4_2(x)   (0x80u <= (ucs4)(x) && (ucs4)(x) <= 0x7ffu)
#define IS_UCS4_3(x)   (0x800u <= (ucs4)(x) && (ucs4)(x) <= 0xffffu)
#define IS_UCS4_4(x)   (0x10000u <= (ucs4)(x) && (ucs4)(x) <= 0x1fFFFFu)
#define IS_UCS4_5(x)   (0x200000u <= (ucs4)(x) && (ucs4)(x) <= 0x3ffFFFFu)
#define IS_UCS4_6(x)   (0x4000000u <= (ucs4)(x) && (ucs4)(x) <= 0x7fffFFFFu)
#define IS_UCS4_I(x)   (0x80u <= (ucs4)(x) && (ucs4)(x) <= 0xffu)
#define IS_UTF8_1(c)   (0x00 == ((c) & 0x80))
#define IS_UTF8_2(c)   (0xc0 == ((c) & 0xe0))
#define IS_UTF8_3(c)   (0xe0 == ((c) & 0xf0))
#define IS_UTF8_4(c)   (0xf0 == ((c) & 0xf8))
#define IS_UTF8_5(c)   (0xf8 == ((c) & 0xfc))
#define IS_UTF8_6(c)   (0xfc == ((c) & 0xfe))
#define IS_UTF8_I(c)   (0xc0 == ((c) & 0xfc))
#define IS_UTF8_S1(s)   (IS_UTF8_1(s[0]))
#define IS_UTF8_S2(s)   (IS_UTF8_2(s[0])&&((s)[1]&192)==128)
#define IS_UTF8_S3(s)   (IS_UTF8_3(s[0])&& ((s)[1]&192)==128&&((s)[2]&192)==128)
#define IS_UTF8_S4(s)   (IS_UTF8_4(s[0])&& ((s)[1]&192)==128&&((s)[2]&192)==128&&((s)[3]&192)==128)
#define IS_UTF8_S5(s)
#define IS_UTF8_S6(s)
#define IS_UTF8_SI(s)   (IS_UTF8_I(s[0])&&((s)[1]&192)==128)
#define IS_UTF8_X(c)   (0x80 == ((c) & 0xc0))
#define UCS4_S1(s)   ((ucs4)(s[0]))
#define UCS4_S2(s)
#define UCS4_S3(s)
#define UCS4_S4(s)
#define UCS4_S5(s)
#define UCS4_S6(s)
#define UTF8_LEN2(x)   (IS_UCS4_1(x) || IS_UCS4_2(x) && 2 || IS_UCS4_3(x) && 3)
#define UTF8_LEN4(x)
#define UTF8_S1(s, c)   ((s)[0]=(c))
#define UTF8_S2(s, c)
#define UTF8_S3(s, c)
#define UTF8_S4(s, c)
#define UTF8_S5(s, c)
#define UTF8_S6(s, c)


typedef unsigned char ucs1
typedef unsigned short ucs2
typedef unsigned int ucs4
typedef unsigned short utf16


SOFIAPUBFUN size_t ucs18decode (char *dst, size_t dst_size, const utf8 *s)
SOFIAPUBFUN size_t ucs1declen (const utf8 *s)
SOFIAPUBFUN size_t ucs1enclen (const ucs1 *s, size_t n, const char quote[128])
SOFIAPUBFUN size_t ucs1encode (utf8 *dst, const ucs1 *s, size_t n, const char quote[128])
int ucs2cmp (ucs2 const *s1, ucs2 const *s2)
size_t ucs2declen (const utf8 *s)
size_t ucs2decode (ucs2 *dst, size_t dst_size, const utf8 *s)
size_t ucs2enclen (const ucs2 *s, size_t n, const char quote[128])
size_t ucs2encode (utf8 *dst, const ucs2 *s, size_t n, const char quote[128])
size_t ucs2len (ucs2 const *s)
int ucs2ncmp (ucs2 const *s1, ucs2 const *s2, size_t n)
int ucs4cmp (ucs4 const *s1, ucs4 const *s2)
size_t ucs4declen (const utf8 *s)
size_t ucs4decode (ucs4 *dst, size_t dst_size, const utf8 *s)
size_t ucs4enclen (const ucs4 *s, size_t n, const char quote[128])
size_t ucs4encode (utf8 *dst, const ucs4 *s, size_t n, const char quote[128])
size_t ucs4len (ucs4 const *s)
int ucs4ncmp (ucs4 const *s1, ucs4 const *s2, size_t n)
SOFIAPUBFUN size_t utf8_width (const utf8 *)


unsigned char 

Generated by  Doxygen 1.6.0   Back to index