-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathced.cpp
More file actions
30 lines (24 loc) · 699 Bytes
/
Copy pathced.cpp
File metadata and controls
30 lines (24 loc) · 699 Bytes
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
#include "compact_enc_det/compact_enc_det.h"
extern bool FLAGS_ced_allow_utf8utf8;
extern "C" const char *ced_detect_encoding(const char *text, int text_length, bool allow_utf8utf8) {
bool is_reliable;
int bytes_consumed;
FLAGS_ced_allow_utf8utf8 = allow_utf8utf8;
Encoding encoding = CompactEncDet::DetectEncoding(
text,
text_length,
nullptr,
nullptr,
nullptr,
UNKNOWN_ENCODING,
UNKNOWN_LANGUAGE,
CompactEncDet::QUERY_CORPUS,
true,
&bytes_consumed,
&is_reliable
);
return MimeEncodingName(encoding);
}
extern "C" const char *ced_version() {
return CompactEncDet::Version();
}