File: identify_encoding.h

package info (click to toggle)
libapache-mod-encoding 0.0.20021209-12
  • links: PTS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,700 kB
  • sloc: ansic: 94,406; sh: 6,693; makefile: 43
file content (43 lines) | stat: -rw-r--r-- 1,026 bytes parent folder | download | duplicates (5)
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
/*
 *
 * ɤȽ̤iconv Ѥʸ󥳡ǥʸ֤
 *
 * 2001/10/24  Remove static variables
 *             Kazuhiko Iwama <iwama@ymc.ne.jp>
 * 2001/10/14  First version
 *             Kazuhiko Iwama <iwama@ymc.ne.jp>
 *
 */

#ifndef IDENTIFY_ENCODING_H
#define IDENTIFY_ENCODING_H

#define IDENTIFY_MAX_LENGTH 256

enum identify_encoding_order {
    ieo_EUCJP = 0,
    ieo_SJIS  = 1
};

typedef struct {
    int flag;
    int state;
    int c_type;
} ie_state_t;

typedef struct {
    enum identify_encoding_order order;
    ie_state_t  st_ascii;
    ie_state_t  st_jis;
    ie_state_t  st_sjis;
    ie_state_t  st_eucjp;
    ie_state_t  st_utf8;
} identify_encoding_t;

identify_encoding_t* identify_encoding_open(enum identify_encoding_order order);
void identify_encoding_close(identify_encoding_t* cd);
void identify_encoding_reset(identify_encoding_t* cd);
const char *identify_encoding(identify_encoding_t *cd, char* instr);
const char *autodetect_encoding(char* instr, char *default_enc);

#endif