作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
为什么当我将INT值转换为字节,再转换为ASCII并返回时,又得到另一个值?
例子:
var asciiStr = new string(Encoding.ASCII.GetChars(BitConverter.GetBytes(2000)));
var intVal = BitConverter.ToInt32(Encoding.ASCII.GetBytes(asciiStr), 0);
Console.WriteLine(intVal);
// Result: 1855
最佳答案
ASCII仅是7位-不支持127
以上的代码点。每个the docs on ?
会将不支持的字符转换为Encoding.ASCII
:
The ASCIIEncoding object that is returned by this property might not have the appropriate behavior for your app. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character.
2000
十进制=
D0 07 00 00
十六进制(小端)=
[unsupported character] [BEL character] [NUL character] [NUL character]
=
? [BEL character] [NUL character] [NUL character]
=
3F 07 00 00
十六进制(小端)=
1855
十进制。
关于c# - 将整数转换为ASCII然后再返回整数后,为什么会得到一个不同的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64263799/
我有本地更改和远程更改。 有人告诉我必须先推,再 pull 。这背后有什么原因吗? 最佳答案 那个人错了:正确的模型是pull-before-you-push,而不是相反。 当您pull时,git 将
我正在使用最新版本的 Flat UI Pro 1.3.2 ( http://designmodo.com/flat/ ),jQuery 插件 flatui-radiocheck v0.1.0 和 iO
我是一名优秀的程序员,十分优秀!