How to convert the encoding type of a stream in .NET?
I ve the following stream but I don't know its encoding type because the stream reader detects encoding from byte order marks
Dim reader As StreamReader = New StreamReader(respStream, True)
so开发者_如何转开发 how can I detect the encoding type AND convert it to another type? (for ex. from ASCII to UTF8)
PS:
What is the difference with the following line?
Dim reader As StreamReader = New StreamReader(respStream,
Encoding.ASCII, True)
Thank You in advance,
Max
You can check the StreamReader's CurrentEncoding
property, and you can write the string to a StreamWriter
with a different Encoding.
To answer your unrelated question, that explicitly specifies the encoding.
精彩评论