.NET内部编码

什么是.NET应用程序的内部编码?(例如字符串对象)我可以定义应用程序应该使用的编码吗?如果我将.net字符串写入文件.字符串有什么编码?

//编辑

Dim test as String="Das ist ein Test" <---what Encoding has this String?

Dim reader as New IO.StreamReader(docPath, _
    System.Text.Encoding.GetEncoding("shift-jis"))

test=reader.ReadToEnd() <---and now? What Encoding has this String?

谢谢!

Dim test as String="Das ist ein Test" <---what Encoding has this String?

UTF-16

Dim reader as New IO.StreamReader(docPath,
    System.Text.Encoding.GetEncoding("shift-jis"))
test=reader.ReadToEnd <---and now? What Encoding has this String?

仍然是UTF-16. StreamReader类查看docPath中的字节,并根据shift-jis编码将它们转换为UTF-16.

相关文章
相关标签/搜索