开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜