Hello everybody!
Does anyone know how to solve such problem: I have a file with some german/russian characters and I need to read this data into a stream without any loss.
Currently the code is following:
If LogFileOpenDialog.ShowDialog() = DialogResult.OK Then
CmmlStream = LogFileOpenDialog.OpenFile()
End If
CmmlReader = New StreamReader(CmmlStream, Encoding.ASCII)
CmmlReader.BaseStream.Seek(0, SeekOrigin.Begin)
intTotalLength = System.Convert.ToInt32(CmmlReader.BaseStream.Length())
intLineLength = 0
Try
While CmmlReader.Peek() > -1
strImportLine = CmmlReader.ReadLine()
Catch ex As Exception
MessageBox.Show("Wrong import file format. Operation was canceled. " + ex.Message, Me.Text)
Return
Finally
CmmlStream.Close()
CmmlReader.Close()
End Try
but when I change Encoding.ASCII to Encoding.Unicode I get such rectangles for all the characters. If I use ASCII then I get ???? instead of some unicode characters.
Will be very thankful for any help.
Thanks,
Alex
Does anyone know how to solve such problem: I have a file with some german/russian characters and I need to read this data into a stream without any loss.
Currently the code is following:
If LogFileOpenDialog.ShowDialog() = DialogResult.OK Then
CmmlStream = LogFileOpenDialog.OpenFile()
End If
CmmlReader = New StreamReader(CmmlStream, Encoding.ASCII)
CmmlReader.BaseStream.Seek(0, SeekOrigin.Begin)
intTotalLength = System.Convert.ToInt32(CmmlReader.BaseStream.Length())
intLineLength = 0
Try
While CmmlReader.Peek() > -1
strImportLine = CmmlReader.ReadLine()
Catch ex As Exception
MessageBox.Show("Wrong import file format. Operation was canceled. " + ex.Message, Me.Text)
Return
Finally
CmmlStream.Close()
CmmlReader.Close()
End Try
but when I change Encoding.ASCII to Encoding.Unicode I get such rectangles for all the characters. If I use ASCII then I get ???? instead of some unicode characters.
Will be very thankful for any help.
Thanks,
Alex