| Enca Library Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
EncaEncoding;
#define ENCA_CS_UNKNOWN
enum EncaSurface;
enum EncaCharsetFlags;
enum EncaNameStyle;
enum EncaErrno;
#define ENCA_NOT_A_CHAR
typedef struct {
int charset; EncaSurface surface;
} EncaEncoding;
Encoding, i.e. charset and surface.
This is what enca_analyse() and enca_analyse_const() return.
The charset field is an opaque numerical charset identifier, which has no
meaning outside Enca library.
You will probably want to use it only as enca_charset_name() argument.
It is only guaranteed not to change meaning
during program execution time; change of its interpretation (e.g. due to
addition of new charsets) is not considered API change.
The surface field is a combination of EncaSurface flags. You may want
to ignore it completely; you should use enca_set_interpreted_surfaces()
to disable weird surfaces then.
int |
Numeric charset identifier. |
EncaSurface |
Surface flags. |
#define ENCA_CS_UNKNOWN (-1)
Unknown character set id.
Use enca_charset_is_known() to check for unknown charset instead of direct
comparsion.
typedef enum { /*< flags >*/
ENCA_SURFACE_EOL_CR = 1 << 0,
ENCA_SURFACE_EOL_LF = 1 << 1,
ENCA_SURFACE_EOL_CRLF = 1 << 2,
ENCA_SURFACE_EOL_MIX = 1 << 3,
ENCA_SURFACE_EOL_BIN = 1 << 4,
ENCA_SURFACE_MASK_EOL = (ENCA_SURFACE_EOL_CR
| ENCA_SURFACE_EOL_LF
| ENCA_SURFACE_EOL_CRLF
| ENCA_SURFACE_EOL_MIX
| ENCA_SURFACE_EOL_BIN),
ENCA_SURFACE_PERM_21 = 1 << 5,
ENCA_SURFACE_PERM_4321 = 1 << 6,
ENCA_SURFACE_PERM_MIX = 1 << 7,
ENCA_SURFACE_MASK_PERM = (ENCA_SURFACE_PERM_21
| ENCA_SURFACE_PERM_4321
| ENCA_SURFACE_PERM_MIX),
ENCA_SURFACE_QP = 1 << 8,
ENCA_SURFACE_REMOVE = 1 << 13,
ENCA_SURFACE_UNKNOWN = 1 << 14,
ENCA_SURFACE_MASK_ALL = (ENCA_SURFACE_MASK_EOL
| ENCA_SURFACE_MASK_PERM
| ENCA_SURFACE_QP
| ENCA_SURFACE_REMOVE)
} EncaSurface;
Surface flags.
| End-of-lines are represented with CR's. | |
| End-of-lines are represented with LF's. | |
| End-of-lines are represented with CRLF's. | |
| Several end-of-line types, mixed. | |
| End-of-line concept not applicable (binary data). | |
| Mask for end-of-line surfaces. | |
| Odd and even bytes swapped. | |
| Reversed byte sequence in 4byte words. | |
| Chunks with both endianess, concatenated. | |
| Mask for permutation surfaces. | |
| Quoted printables. | |
| Recode `remove' surface. | |
| Unknown surface. | |
| Mask for all bits, withnout ENCA_SURFACE_UNKNOWN. |
typedef enum { /*< flags >*/
ENCA_CHARSET_7BIT = 1 << 0,
ENCA_CHARSET_8BIT = 1 << 1,
ENCA_CHARSET_16BIT = 1 << 2,
ENCA_CHARSET_32BIT = 1 << 3,
ENCA_CHARSET_FIXED = 1 << 4,
ENCA_CHARSET_VARIABLE = 1 << 5,
ENCA_CHARSET_BINARY = 1 << 6,
ENCA_CHARSET_REGULAR = 1 << 7,
ENCA_CHARSET_MULTIBYTE = 1 << 8
} EncaCharsetFlags;
Charset properties.
Flags ENCA_CHARSET_7BIT, ENCA_CHARSET_8BIT, ENCA_CHARSET_16BIT,
ENCA_CHARSET_32BIT tell how many bits a `fundamental piece' consists of.
This is different from bits per character; r.g. UTF-8 consists of 8bit
pieces (bytes), but character can be composed from 1 to 6 of them.
| Characters are represented with 7bit characters. | |
| Characters are represented with bytes. | |
| Characters are represented with 2byte words. | |
| Characters are represented with 4byte words. | |
| One characters consists of one fundamental piece. | |
| One character consists of variable number of fundamental pieces. | |
| Charset is binary from ASCII viewpoint. | |
| Language dependent (8bit) charset. | |
| Multibyte charset. |
typedef enum {
ENCA_NAME_STYLE_ENCA,
ENCA_NAME_STYLE_RFC1345,
ENCA_NAME_STYLE_CSTOCS,
ENCA_NAME_STYLE_ICONV,
ENCA_NAME_STYLE_HUMAN,
ENCA_NAME_STYLE_MIME
} EncaNameStyle;
Charset naming styles and conventions.
| Default, implicit charset name in Enca. | |
| RFC 1345 or otherwise canonical charset name. | |
| Cstocs charset name (may not exist). | |
| Iconv charset name (may not exist). | |
| Human comprehensible description. | |
| Preferred MIME name (may not exist). |
typedef enum {
ENCA_EOK = 0,
ENCA_EINVALUE,
ENCA_EEMPTY,
ENCA_EFILTERED,
ENCA_ENOCS8,
ENCA_ESIGNIF,
ENCA_EWINNER,
ENCA_EGARBAGE
} EncaErrno;
Error codes.
| OK. | |
| Invalid value (usually of an option). | |
| Sample is empty. | |
| After filtering, (almost) nothing remained. | |
| Mulitibyte tests failed and language contains no 8bit charsets. | |
| Too few significant characters. | |
| No clear winner. | |
| Sample is garbage. |