ahk-chardet Detect File/Var Encoding

Post your working scripts, libraries and tools for AHK v1.1 and older
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

ahk-chardet Detect File/Var Encoding

Post by tuzi » 09 Dec 2023, 02:02

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

Return to “Scripts and Functions (v1)”