I just converted a project fromo VB 2003.Net to 2005. Now, I am gettng this
error:
The output char buffer is too small to contain the decoded characters,
encoding 'Unicode (UTF-8)' fallback
Here is the code:
Dim strRead As String = ""
Dim fsReadStream As New FileStream(L3FileName, FileMode.Open,
FileAccess.Read)
Dim brReader As New BinaryReader(fsReadStream)
Dim ByteArray() As Byte
Dim n As Integer
While brReader.PeekChar() -1 '<-----Fails here and just gets stuck
ByteArray = brReader.ReadBytes(1)
strRead = strRead & byteArrayToString(ByteArray)
n = fsReadStream.Position
If InStr(strRead, "<EndTag>") Then
Exit While
End If
End While
Public Function byteArrayToString(ByVal b() As Byte) As String
Dim i As Integer
Dim s As New System.Text.StringBuilder
For i = 0 To b.Length - 1
s.Append(Chr(b(i)))
Next
Return s.ToString
End Function
I am reading a file and it appears to get stuck on some non-standard
characters in the file.
TIA,
--
Anil Gupte
www.keeninc.net
www.icinema.com