Orion9

|
Posted: Fri Jan 31, 2025 13:01 Post subject: |
|
|
Вот примерно о чём идет речь:
Quote: | uchardet
uchardet is an encoding detector library, which takes a sequence of bytes in an unknown character encoding without any additional information, and attempts to determine the encoding of the text. Returned encoding names are iconv-compatible.
uchardet started as a C language binding of the original C++ implementation of the universal charset detection library by Mozilla. It can now detect more charsets, and more reliably than the original implementation.
History
As said in introduction, this was initially a project of Mozilla to allow better detection of page encodings, and it used to be part of Firefox. If not mistaken, this is not the case anymore (probably because nowadays most websites better announce their encoding, and also UTF-8 is much more widely spread).
Techniques used by universalchardet are described at https://www-archive.mozilla.org/projects/intl/universalcharsetdetection
It is to be noted that a lot has changed since the original code, yet the base concept is still around, basing detection not just on encoding rules, but importantly on analysis of character statistics in languages.
https://www.freedesktop.org/wiki/Software/uchardet/ |
Если верить этой странице, даже Notepad++ когда-то использовал эту библиотеку для определения кодировки текста.
В общем, очень хотелось бы иметь плагин, основанный на этой (или подобной этой) библиотеке. Пока я нашел только скомпилированную версию консольной утилиты:
https://github.com/JetDemo/uchardet
Консольную утилиту можно использовать в плагине WinScriptAdv или Autorun для вывода данных в колонки ТС. Но это только версия 0.0.6 библиотеки, а сейчас уже есть версия 0.0.8, кто-нибуть может скомпилировать последнюю версию? Очень неплохо себя показывает на тестовых файлах по второй ссылке.
Если кому-то интересно, то:
 Подключение через Autorun Code: | Pragma AutorunPluginFields "Encoding:::CharDetect"
Func CharDetect(FileName, FieldIndex, UnitIndex)
Local pipe, exe_tool = %COMMANDER_PATH% & "\Ini\Tools\uchardet.exe"
ProcessExecGetOutput pipe %exe_tool% '"%FileName%"'
Return pipe
EndFunc
|
|
|