解决方法
Chr
command的文档中定义:
The returned value depends on the code page for the current thread,which is contained in the ANSICodePage property of the TextInfo class in the System.Globalization namespace. You can obtain ANSICodePage by specifying System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage.
因此,Chr的值大于127的输出是系统相关的.如果需要可重现的结果,请通过调用Encoding.GetEncoding(String)创建所需的编码实例,然后使用Encoding.GetChars(Byte())将数值转换为字符.
如果您在问题中链接的图表中的go up one level,您将看到他们没有声称此图表始终是Chr命令的输出:
The characters that appear in Windows above 127 depend on the selected typeface.
The charts in this section show the default character set for a console application.
您的应用程序是WinForm应用程序,而不是控制台应用程序.即使在控制台中,也可以更改使用的字符集(例如,使用chcp命令),因此单词“default”.
有关.net中使用的编码的详细信息,我建议使用以下MSDN文章:Character Encoding in the .NET Framework.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。