Hi everyone I have a text fie contain some Unicode characters when I load the file I get a ?????? Instead of the Unicode character
i thought internet explorer Support Unicode
here is my code
thanks alot
Private Sub Form_Load()
Open App.Path & "/" & "home.txt" For Input As #1
WebBrowser1.Navigate "about:" & Input$(LOF(1), 1)
Close #1
End Sub
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
i have a text file contain some Unicode characters how do load them correctly in web browser
when i open the text file i only get the question marks ?????????
thanks
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
do have to use Microsoft Forms 2.0 Object to open a text file or html contain Unicode
works fine when navigate to file
WebBrowser1.Navigate (App.Path & "\" & "1.html")
why doesn't work using open statement
Try opening it in Binary mode....
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
This matter is a bit more complicated than you may think. If it is truly a Unicode file, it then may have a byte-order mark in it. To test this I have a bit of testing code:
Code:
' Module1.bas
Option Explicit
Public Enum ByteOrderMark
[BOM None] = 0
[BOM Little-Endian] = &HFEFF&
[BOM Big-Endian] = &HFFFE&
[BOM UTF-8] = &HBFBBEF
End Enum
Public Function BOM(ByVal FilesFirstBytes As Long) As ByteOrderMark
If (FilesFirstBytes And &HFFFF&) = [BOM Little-Endian] Then
BOM = [BOM Little-Endian]
ElseIf (FilesFirstBytes And &HFFFF&) = [BOM Big-Endian] Then
BOM = [BOM Big-Endian]
ElseIf (FilesFirstBytes And &HFFFFFF) = [BOM UTF-8] Then
BOM = [BOM UTF-8]
End If
End Function
Code:
' Form1.frm
Option Explicit
Private Sub Form_Load()
Dim bytFile() As Byte, lngBOM As Long
Open App.Path & "/" & "little-endian.txt" For Binary Access Read As #1
'Open App.Path & "/" & "big-endian.txt" For Binary Access Read As #1
'Open App.Path & "/" & "utf-8.txt" For Binary Access Read As #1
'Open App.Path & "/" & "utf-8 (no bom).txt" For Binary Access Read As #1
'Open App.Path & "/" & "windows-1252.txt" For Binary Access Read As #1
Get #1, , lngBOM
Select Case BOM(lngBOM)
Case [BOM Little-Endian]
Debug.Print "The file is UTF-16 Little-Endian"
Seek #1, 3
Case [BOM Big-Endian]
Debug.Print "The file is UTF-16 Big-Endian"
Seek #1, 3
Case [BOM UTF-8]
Debug.Print "The file is UTF-8"
Seek #1, 4
Case Else
Debug.Print "The file has no Unicode byte-order mark; it could be UTF-8 encoding or any known character set"
Seek #1, 1
End Select
' read all of the file minus BOM
ReDim bytFile(LOF(1) - Seek(1))
Get #1, , bytFile
Close #1
End Sub
The project is attached. Test the code against your home.txt file so we know what we are actually dealing with.
Hi everyone I have a text fie contain some Unicode characters when I load the file I get a ?????? Instead of the Unicode character
i thought internet explorer Support Unicode
here is my code
thanks alot
Private Sub Form_Load()
Open App.Path & "/" & "home.txt" For Input As #1
WebBrowser1.Navigate "about:" & Input$(LOF(1), 1)
Close #1
End Sub
Try This
Code:
Private Sub Command1_Click()
Dim f As Long
Dim read As String
f = FreeFile()
Open "C:\home.txt" For Binary As #f
read = InputB(10, #f)
Close #f
Web.Navigate "about:" & read
End Sub
Im Pro in C#,VB.NET,Batch,Socket Programming, SPY Software Programming, VB6, Win32Api, VBscript, Windows Registry, ASP.NET, PHP, Jquery, AJAX.