? Hola! No save. TXT encoded as unicode, test the following code, shown or not correct!
Dim textBytes () As Byte, headBytes (2) the As Byte
Fn=App. Path & amp; "\ test. TXT"
If Dir (fn)="" Then
MsgBox "file does not exist, please click on" write "button to generate" MyUnicode. TXT "file", vbInformation
The Exit Sub
End the If
The Open fn For Binary As # 1
Get # 1, and headBytes () 'read the file header,
Close # 1
If headBytes (0)=255 And headBytes (1)=254 Then 'is Unicode, hex is: FF, FE,
The Open fn For Binary As # 1
ReDim textBytes (LOF (1) - (2) '2 bytes occupied minus the file header,
Get the # 1, 3, textBytes () 'third byte to text content,
Close # 1
Text1. Text=textBytes () 'in VB is a UniCode string format, so direct assignment UniCode code can display Text content,
RichTextBox1. Text=textBytes ()
The Else
MsgBox "Unicode, will not be read, please click the" write "button,", vbInformation
End the If
CodePudding user response:
Should remember correctly, the third byte index is 2Get the # 1, 3, textBytes () 'third byte to text content,
CodePudding user response:
, shown as the code is to prove your control does not support Unicode characters display! With Microsoft Forms 2.0 Object Library TextBox controls give it a try,CodePudding user response:
Tested this code on my machine completely true,CodePudding user response:
Test your Spanish, garbled, could be control is too old, do not support the new characters, some of the font is not displayed correctly,Characters such as the euro, some old program is to display,
CodePudding user response:
Like this character, if you stick to vb Exe is garbled, so you in any way to read a file to display to the text, he also must be garbled,I tried 6, 7 kinds of fonts, didn't also found not gibberish,
Stick to the vc exe, was entirely normal,
CodePudding user response: