Option Explicit
Private Sub Form_Load()
Dim MLang As CMultiLanguage
Dim IMLang2 As IMultiLanguage2
Dim Encoding() As tagDetectEncodingInfo
Dim encCount As Long
Dim inp() As Byte
Dim index As Long
Open "c:\Test.txt" For Binary As #1
ReDim inp(LOF(1) - 1)
Get #1, , inp()
Close #1
Set MLang = New CMultiLanguage
Set IMLang2 = MLang
encCount = 16
ReDim Encoding(encCount - 1)
IMLang2.DetectInputCodepage 0, 0, inp(0), UBound(inp) + 1, Encoding(0), encCount
For index = 0 To encCount - 1
If Encoding(index).nCodePage = 65001 Then 'UTF-8
Debug.Print "Задетектирован UTF-8, вероятность " & Encoding(index).nConfidence
End If
Next
End Sub