Page 1 of 1

ahk-chardet Detect File/Var Encoding

Posted: 09 Dec 2023, 02:02
by tuzi
base on uchardet.dll v0.0.8 and swagfag 's code, i create a lib ahk-chardet.

hope it helps someone in need. :D

usage:

Code: Select all

MsgBox % FileGetCodePageByBom("test\fr\utf-16.be")  ; 1201

MsgBox % FileGetCharset("test\ja\iso-2022-jp.txt")  ; ISO-2022-JP
MsgBox % FileGetCodePage("test\ja\iso-2022-jp.txt") ; 50220

FileRead binary, *c test\ja\iso-2022-jp.txt
MsgBox % VarGetCharset(binary)                      ; ISO-2022-JP
MsgBox % VarGetCodePage(binary)                     ; 50220
ExitApp

#Include Lib\uchardet.ahk