View Source CharsetDetect (CharsetDetect v0.1.3)

CharsetDetect is a simple wrapper around the chardetng crate.

Summary

Functions

Guess the encoding of a string.

Guess the encoding of a string (exceptional).

Functions

guess(body)

@spec guess(binary()) :: {:ok, String.t()} | {:error, String.t()}

Guess the encoding of a string.

Examples

iex> File.read!("test/assets/sjis.txt") |> CharsetDetect.guess
{:ok, "Shift_JIS"}

guess!(body)

@spec guess!(binary()) :: String.t()

Guess the encoding of a string (exceptional).

Examples

iex> File.read!("test/assets/big5.txt") |> CharsetDetect.guess!
"Big5"