- ©«¤l
- 22
- ¥DÃD
- 17
- ºëµØ
- 0
- ¿n¤À
- 51
- ÂI¦W
- 0
- §@·~¨t²Î
- wiindows
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ·s¥_
- µù¥U®É¶¡
- 2021-6-21
- ³Ì«áµn¿ý
- 2022-1-4
|
ºô¸ô¤W§ä¨ì vb Ū¨úunicode ªº¤èªk
Dim textBytes() As Byte, headBytes(2) As Byte
fn = App.Path & "\test.txt"
If Dir(fn) = "" Then
MsgBox "¤å¥ó¤£¦s¦b¡A½Ð¥ý«ö¤@¤U¡i¼g¤J¡j«ö¶s¥Í¦¨¡§MyUnicode.txt¡¨¤å¥ó¡C", vbInformation
Exit Sub
End If
Open fn For Binary As #1
Get #1, , headBytes() 'Ū¨ú¤å¥óÀY¡C
Close #1
If headBytes(0) = 255 And headBytes(1) = 254 Then '¬OUnicode½s½X¡C¤Q¤»¶i¦ì¬°¡GFF ¡BFE¡C
Open fn For Binary As #1
ReDim textBytes(LOF(1) - 2) '´î¥h¤å¥óÀY¦û¥Îªº2Ӧ줸²Õ¡C
Get #1, 3, textBytes() '²Ä¤TӦ줸²Õ°_¬°¤å¥»¤º®e¡C
Close #1
Text1.Text = textBytes() '¦b VB ¤¤¦r¦ê¬O UniCode ®æ¦¡¡A©Ò¥HUnicode½Xª½±µ½áȧY¥iÅã¥Ü¤å¥»¤º®e¡C
RichTextBox1.Text = textBytes()
Else
MsgBox "«DUnicode½s½X¡A¤£¤©Åª¤J¡A½Ð«ö¤@¤U¡i¼g¤J¡j«ö¶s¡C", vbInformation
End If |
|