ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[Âà¶K] vb Ū¨úunicode

[Âà¶K] vb Ū¨úunicode

ºô¸ô¤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
µ{¦¡¤H­û

        ÀR«ä¦Û¦b : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD