netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
utf8.c File Reference
`#include <arpa/inet.h>`
`#include <errno.h>`
`#include <stdlib.h>`
`#include <atalk/byteorder.h>`
`#include <atalk/logger.h>`
`#include <atalk/unicode.h>`

## Macros
#define | GETUCVAL(utf8_trailbyte, shift)
#define | GETUTF8TRAILBYTE(uc, shift)

## Functions
static size_t | utf8_pull (void *cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
| Convert from UTF-8 to UTF-16.
static size_t | utf8_push (void *, char **, size_t *, char **, size_t *)

## Variables
struct charset_functions | charset_utf8
struct charset_functions | charset_utf8_mac

## Detailed Description

See also
  The Unicode Standard Version 6.2 – Core Specification http://www.unicode.org/versions/Unicode6.2.0/ch03.pdf
  Scalar Value First Second Third Fourth
  00000000 0xxxxxxx 0xxxxxxx
  00000yyy yyxxxxxx 110yyyyy 10xxxxxx
  zzzzyyyy yyxxxxxx 1110zzzz 10yyyyyy 10xxxxxx
  000uuuuu zzzzyyyy yyxxxxxx 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx

## Macro Definition Documentation

## ◆ GETUCVAL

#define GETUCVAL | ( |  | utf8_trailbyte,
|  |  | shift )

Value:
((unsigned int) (( utf8_trailbyte & 0x3F) << shift))

Given a trailing UTF-8 byte, get the contribution from it to the Unicode scalar value for a particular bit shift amount

## ◆ GETUTF8TRAILBYTE

#define GETUTF8TRAILBYTE | ( |  | uc,
|  |  | shift )

Value:
((char)( 0x80 | ((uc >> shift) & 0x3F) ) )

Given a unicode scalar, get a trail UTF-8 byte for a particular bit shift amount

## Function Documentation

## ◆ utf8_pull()

size_t utf8_pull | ( | void * | cd,
|  | char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft )
| static

Convert from UTF-8 to UTF-16.

Code Points First Second Third Fourth
U+0000..U+007F 00..7F
U+0080..U+07FF C2..DF 80..BF
U+0800..U+0FFF E0 A0..BF 80..BF
U+1000..U+CFFF E1..EC 80..BF 80..BF
U+D000..U+D7FF ED 80..9F 80..BF
U+E000..U+FFFF EE..EF 80..BF 80..BF
U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
U+100000..U+10FFFF F4 80..8F 80..BF 80..BF

## ◆ utf8_push()

size_t utf8_push | ( | void * | cd,
|  | char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft )
| static

Convert from UTF-16 to UTF-8

## Variable Documentation

## ◆ charset_utf8

struct charset_functions charset_utf8

Initial value:
= {
"UTF8",
0x08000103,
utf8_pull,
utf8_push,
CHARSET_VOLUME | CHARSET_MULTIBYTE | CHARSET_PRECOMPOSED,
NULL,
NULL,
NULL
}
CHARSET_PRECOMPOSED
#define CHARSET_PRECOMPOSED
Definition unicode.h:30
CHARSET_VOLUME
#define CHARSET_VOLUME
Definition unicode.h:29
CHARSET_MULTIBYTE
#define CHARSET_MULTIBYTE
Definition unicode.h:32
utf8_pull
static size_t utf8_pull(void *, char **, size_t *, char **, size_t *)
Convert from UTF-8 to UTF-16.
Definition utf8.c:103
utf8_push
static size_t utf8_push(void *, char **, size_t *, char **, size_t *)
Definition utf8.c:227
NULL
#define NULL
Definition utf8util.c:47

## ◆ charset_utf8_mac

struct charset_functions charset_utf8_mac

Initial value:
= {
"UTF8-MAC",
0x08000103,
utf8_pull,
utf8_push,
CHARSET_VOLUME | CHARSET_CLIENT | CHARSET_MULTIBYTE | CHARSET_DECOMPOSED,
NULL,
NULL,
NULL
}
CHARSET_DECOMPOSED
#define CHARSET_DECOMPOSED
Definition unicode.h:31
CHARSET_CLIENT
#define CHARSET_CLIENT
Definition unicode.h:28