.NET内部编码 [英] .NET internal Encoding

查看:139
本文介绍了.NET内部编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是.NET应用程序的内部编码?(比如字符串对象),我可以定义编码我应用的新应该使用?如果我写一个.NET字符串的文件。什么编码有串?

//修改

 暗淡测试为String =达斯北京时间EIN测试< ---什么编码有这个字符串?

昏暗的阅读器,新IO.StreamReader(docPath,_
    System.Text.Encoding.GetEncoding(SJIS))

测试= reader.ReadToEnd()< ---而现在?什么编码有这个字符串?
 

感谢您!

解决方案

 暗淡测试为String =达斯北京时间EIN测试< ---什么编码有这个字符串?
 

UTF-16

 昏暗的阅读器,新IO.StreamReader(docPath,
    System.Text.Encoding.GetEncoding(SJIS))
测试= reader.ReadToEnd< ---而现在?什么编码有这个字符串?
 

不过UTF-16。该的StreamReader 类着眼于 docPath 字节并将其转换为UTF-16的基础上移位JIS编码。

what is the internal encoding from .NET applications?(for example string objects) Can I define what encoding my appliction should use? If i write a .net string to a file. What encoding has the string?

//edit

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?

Thank you!

解决方案

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?

Still UTF-16. The StreamReader class looks at the bytes in docPath and converts them to UTF-16 based on the shift-jis encoding.

这篇关于.NET内部编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆