Shared encoding related functions. More...
Go to the source code of this file.
Macros | |
#define | MAIN_ERR_PREFIX "ENC: " |
Message prefix for ENCODING module. | |
#define | ENC_UC_NORM_DEBUG 0 |
#define | ENC_MIME_PARA_LENGTH_MAX (size_t) 127 |
Maximum length of MIME parameter attribute tokens. | |
#define | ENC_MIME_HEADER_FOLD_ASCII_LINES 1 |
MIME word encoder folding behaviour. More... | |
#define | ENC_UA "\xEF\xBF\xBD" /* U+FFFD */ |
#define | ENC_RC 0xFFFDL /* U+FFFD */ |
#define | ENC_UC_DECOMPOSITION_BUFSIZE (size_t) 16 |
#define | ENC_HDR_BUFSIZE (size_t) 998 |
#define | ENC_FMT_BUFLEN (size_t) 7 |
Enumerations | |
enum | iso2022_state { ISO2022_ASCII, ISO2022_ISO646, ISO2022_JIS_X_0208 } |
enum | uc_hs_type { UC_HST_NONE, UC_HST_L, UC_HST_V, UC_HST_T, UC_HST_LV, UC_HST_LVT } |
Functions | |
void | enc_uc_encode_utf8 (char *buf, size_t *i, long int *dbuf, size_t *di) |
Encode Unicode codepoints to UTF-8. More... | |
const char * | enc_create_name_addr (const char *data, size_t offset) |
Create a "name-addr" construct according to RFC 5322. More... | |
unsigned long int | enc_lines_decode (const char *lines) |
Decode number of lines. More... | |
void | enc_convert_lines_to_string (char *l, unsigned long int l_raw) |
Convert number of lines to string. More... | |
core_time_t | enc_timestamp_decode (const char *timestamp) |
Decode canonical timestamp to POSIX time (seconds since epoche) More... | |
int | enc_convert_posix_to_iso8601 (char *isodate, core_time_t pts) |
Convert POSIX timestamp to ISO 8601 conformant local date and time. More... | |
int | enc_get_iso8601_utc (char *isodate) |
Get current UTC date in ISO 8601 conformant format. More... | |
int | enc_convert_iso8601_to_posix (core_time_t *pts, const char *isodate) |
Convert ISO 8601 conformant UTC date and time to POSIX timestamp. More... | |
int | enc_convert_iso8601_to_timestamp (const char **ts, const char *isodate) |
Convert ISO 8601 conformant date to canonical timestamp. More... | |
int | enc_convert_anum_to_ascii (char result[17], size_t *len, core_anum_t wm) |
Convert article number from numerical format to ASCII. More... | |
int | enc_convert_ascii_to_anum (core_anum_t *result, const char *wm, int len) |
Convert number from ASCII to numerical format. More... | |
int | enc_convert_octet_to_hex (char *result, unsigned int octet) |
Convert octet to hexadecimal (ASCII) format. More... | |
void | enc_rot13 (char *data) |
Encode or decode data with ROT13 algorithm. More... | |
int | enc_mime_encode_base64 (const char **enc, const char *data, size_t len) |
Encode binary data to base64. More... | |
const char * | enc_extract_addr_spec (const char *mailbox) |
Extract addr-spec token from RFC 5322 mailbox. More... | |
int | enc_ascii_check (const char *s) |
Verify ASCII encoding. More... | |
int | enc_ascii_check_alpha (const char *s) |
Check for ASCII alphabetic characters. More... | |
int | enc_ascii_check_digit (const char *s) |
Check for ASCII digit characters. More... | |
int | enc_ascii_check_printable (const char *s) |
Check for printable ASCII characters. More... | |
void | enc_ascii_convert_to_printable (char *s) |
Convert to printable ASCII format. More... | |
void | enc_ascii_convert_distribution (char *s) |
Convert body of distribution header field. More... | |
int | enc_uc_check_utf8 (const char *s) |
Verify UTF-8 encoding. More... | |
const char * | enc_uc_repair_utf8 (const char *s) |
Repair UTF-8 encoding. More... | |
int | enc_create_wildmat (struct enc_wm_pattern **obj, const char *wm) |
Create wildmat pattern array. More... | |
void | enc_destroy_wildmat (struct enc_wm_pattern **obj, int num) |
Destroy wildmat pattern array. More... | |
const char * | enc_convert_canonical_to_posix (const char *s, int rcr, int rlf) |
Convert from canonical (RFC 822) to local (POSIX) form. More... | |
const char * | enc_convert_posix_to_canonical (const char *s) |
Convert from local (POSIX) to canonical (RFC 822) form. More... | |
const char * | enc_convert_to_utf8_nfc (enum enc_mime_cs charset, const char *s) |
Convert string from supported character set to Unicode (UTF-8 NFC) More... | |
const char * | enc_convert_to_8bit (enum enc_mime_cs *charset, const char *s, const char **cs_iana) |
Convert string from Unicode (UTF-8 NFC) to an 8bit character set. More... | |
int | enc_mime_word_encode (const char **r, const char *b, size_t pl) |
Encode header field body using MIME encoded-word tokens. More... | |
int | enc_mime_word_decode (const char **r, const char *b) |
Decode header field containing potential MIME encoded-word tokens. More... | |
int | enc_mime_para_decode (const char **r, const char *b, int m) |
Decode header field containing potential MIME parameters. More... | |
void | enc_mime_get_ct (struct enc_mime_ct *ct, const char *hf_body, char *bo) |
Decode MIME "Content-Type" header field. More... | |
enum enc_mime_cte | enc_mime_get_cte (const char *hf_body) |
Decode content transfer encoding description. More... | |
void | enc_mime_get_cd (const char *hf_body, enum enc_mime_cd *type, const char **filename) |
Decode content disposition. More... | |
int | enc_mime_save_to_file (const char *pn, enum enc_mime_cte cte, const char *entity) |
Decode MIME content transfer encoding and save to file. More... | |
const char * | enc_mime_decode (enum enc_mime_cte cte, enum enc_mime_cs charset, const char *s) |
Decode MIME text content to UTF-8 NFC. More... | |
const char * | enc_mime_flowed_decode (const char *s, unsigned int delsp, unsigned int insline) |
Decode MIME "text/plain" content with "format=flowed" parameter. More... | |
size_t | enc_mime_message (const char *s, size_t len, struct enc_mime_mpe **mpe) |
Extract MIME encapsulated message. More... | |
size_t | enc_mime_multipart (const char *s, const char *b, struct enc_mime_mpe **mpe) |
Parse MIME multipart content. More... | |
int | enc_percent_decode (char *s, int clean) |
Percent decoder. More... | |
const char * | enc_uri_percent_encode (const char *s, enum enc_uri_scheme sch) |
Percent encoding for URI content. More... | |
int | enc_uc_search (const char *s, size_t start_pos, const char *search_s, size_t *found_pos, size_t *found_len) |
void | enc_free (void *p) |
Free an object allocated by encoding module. More... | |
Shared encoding related functions.
Copyright (c) 2012-2023 by the developers. See the LICENSE file for details.
If nothing else is specified, functions return zero to indicate success and a negative value to indicate an error.
Definition in file encoding.c.