← 返回命令列表

Linux command

enca 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Detect encoding

enca [file.txt]

Detect with language

enca -L [czech] [file.txt]

Convert encoding

enca -x [UTF-8] [file.txt]

Detect and show

enca -d [file.txt]

Process multiple files

enca -L [russian] [*.txt]

说明

enca (Extremely Naive Charset Analyser) detects character encodings of text files using language-based statistical heuristics, and can convert files between encodings by piping through iconv. It is particularly strong on legacy 8-bit charsets used for Slavic and Central/Eastern European languages (ISO-8859-2/5, KOI8-R, CP1250/1251, Mazovia, T.61, ...), where simpler tools like file -i struggle. Detection works best with a language hint passed via -L; without it, enca falls back to a general profile and may return ambiguous matches. The output is one detected encoding per file by default, or extended information with -d or -v. Conversion is performed in place with -x _ENCODING_, which calls iconv under the hood; pair it with --cstocs for transliteration when the target charset lacks specific characters.

参数

-L _LANGUAGE_
Hint language for detection.
-x _ENCODING_
Convert to specified encoding.
-d
Show detailed detection info.
-g, --guess
Output best guess only.
-i, --info
Show available encodings.
--help
Display help information.

FAQ

What is the enca command used for?

enca (Extremely Naive Charset Analyser) detects character encodings of text files using language-based statistical heuristics, and can convert files between encodings by piping through iconv. It is particularly strong on legacy 8-bit charsets used for Slavic and Central/Eastern European languages (ISO-8859-2/5, KOI8-R, CP1250/1251, Mazovia, T.61, ...), where simpler tools like file -i struggle. Detection works best with a language hint passed via -L; without it, enca falls back to a general profile and may return ambiguous matches. The output is one detected encoding per file by default, or extended information with -d or -v. Conversion is performed in place with -x _ENCODING_, which calls iconv under the hood; pair it with --cstocs for transliteration when the target charset lacks specific characters.

How do I run a basic enca example?

Run `enca [file.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -L _LANGUAGE_ do in enca?

Hint language for detection.