Option Explicit Private Sub Form_Load Dim MLang As CMultiLanguage Dim

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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