Clone this repo:

Branches

  1. 3ba4720 Merge pull request #21 from Baklap4/fix/conversion-warning by JinsukKim · 8 days ago master
  2. a632e51 Fixed int to char conversion warning for object initialization by Arjan Speiard | Asgard Sings! · 8 days ago
  3. 96e566d Merge pull request #19 from Koellewe/patch-1 by JinsukKim · 6 months ago
  4. d613c43 Merge pull request #18 from OznOg/fix_includes by JinsukKim · 6 months ago
  5. ec1d3d3 Updated autogen.sh with new googletest references by Jans George Rautenbach · 6 months ago

Introduction

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,
        UNKNOWN_ENCODING,
        UNKNOWN_LANGUAGE,
        CompactEncDet::WEB_CORPUS,
        false,
        &bytes_consumed,
        &is_reliable);

How to build

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

$ cd compact_enc_det
$ ./autogen.sh
...
$ 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 .