compact_enc_det - Compact Encoding Detection
C++ Objective-C C Other
Switch branches/tags
Nothing to show
Clone or download
JinsukKim Exclude UTF-16 encoding for automatic detection
UTF-16 encoding has been reported to cause security issues.
This CL makes CED not return UTF-16BE/LE encoding as
detection results when run in HTML5 mode.
Latest commit 94c367a Sep 5, 2017


Compact Encoding Detection(CED for short) is a library written in C++ that scans given raw bytes and detect the most likely text encoding.

Basic usage:

#include "compact_enc_det/compact_enc_det.h"

const char* text = "Input text";
bool is_reliable;
int bytes_consumed;

Encoding encoding = CompactEncDet::DetectEncoding(
        text, strlen(text),
        nullptr, nullptr, nullptr,

How to build

You need CMake to build the package. After unzipping the source code , run to build everything automatically. The script also downloads Google Test framework needed to build the unittest.

$ cd compact_enc_det
$ ./
$ bin/ced_unittest

On Windows, run cmake . to download the test framework, and generate project files for Visual Studio.

D:\packages\compact_enc_det> cmake .