A
AG
I have a file that contains ASCII and Extended ASCII characters.
I need to get the file contents into a string, but the Extended ASCII
characters (dec 128 and 129) are being changed to dec 63.
I have tried several methods, but here is the one I thought would have
worked.
Dim strReturn As String
Dim arBytes() As Byte
arBytes = System.IO.File.ReadAllBytes(<myfile>)
strReturn = System.Text.Encoding.UTF8.GetString(arBytes)
When I examine strReturn, I find that the chars that should be chr(128) and
chr(129) are all chr(63).
The only thing I could get to work is
Dim strReturn As String = String.Empty
Dim arBytes() As Byte
Dim sB As New StringBuilder
Dim byT As Byte
arBytes = System.IO.File.ReadAllBytes(strPathFile)
For Each byT In arBytes
sB.Append(Chr(byT))
Next
strReturn = sB.ToString
Can anyone offer an explanation, and/or a better method?
I need to get the file contents into a string, but the Extended ASCII
characters (dec 128 and 129) are being changed to dec 63.
I have tried several methods, but here is the one I thought would have
worked.
Dim strReturn As String
Dim arBytes() As Byte
arBytes = System.IO.File.ReadAllBytes(<myfile>)
strReturn = System.Text.Encoding.UTF8.GetString(arBytes)
When I examine strReturn, I find that the chars that should be chr(128) and
chr(129) are all chr(63).
The only thing I could get to work is
Dim strReturn As String = String.Empty
Dim arBytes() As Byte
Dim sB As New StringBuilder
Dim byT As Byte
arBytes = System.IO.File.ReadAllBytes(strPathFile)
For Each byT In arBytes
sB.Append(Chr(byT))
Next
strReturn = sB.ToString
Can anyone offer an explanation, and/or a better method?