summaryrefslogtreecommitdiff
path: root/pith/charset.h
blob: e51e70c0fbc4d30c89199d5f658197011dacd9df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * $Id: charset.h 765 2007-10-23 23:51:37Z hubert@u.washington.edu $
 *
 * ========================================================================
 * Copyright 2013-2017 Eduardo Chappa
 * Copyright 2006 University of Washington
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * ========================================================================
 */

#ifndef PITH_CHARSET_INCLUDED
#define PITH_CHARSET_INCLUDED


#include "../pith/filttype.h"


typedef struct conversion_table {
    char          *from_charset;
    char          *to_charset;
    int            quality;
    void          *table;
    filter_t       convert;
} CONV_TABLE;


/* Conversion table quality of tranlation */
#define	CV_NO_TRANSLATE_POSSIBLE	1	/* We don't know how to      */
						/* translate this pair       */
#define	CV_NO_TRANSLATE_NEEDED		2	/* Not necessary, no-op      */
#define	CV_LOSES_SPECIAL_CHARS		3	/* Letters will translate    */
						/* ok but some special chars */
						/* may be lost               */
#define	CV_LOSES_SOME_LETTERS		4	/* Some special chars and    */
						/* some letters may be lost  */


#define	CSET_MAX		64


/* exported protoypes */
char	      *body_charset(MAILSTREAM *, long, unsigned char *);
unsigned char *trans_euc_to_2022_jp(unsigned char *);
unsigned char *rfc1522_decode_to_utf8(unsigned char *, size_t, char *);
char	      *rfc1522_encode(char *, size_t, unsigned char *, char *);
CONV_TABLE    *conversion_table(char *, char *);
void           decode_addr_names_to_utf8(ADDRESS *);
void           convert_possibly_encoded_str_to_utf8(char **);


#endif /* PITH_CHARSET_INCLUDED */