标签云

微信群

扫码加入我们

WeChat QR Code


Does the hex value after the '\u' represent an ASCII character?

2018年09月26日00分12秒

It will, if the number is below 0x80.

2018年09月26日00分12秒

'\u0001' is a valid Unicode code point. Text/Binary is a matter of semantics.

1970年01月01日00分09秒

SebastianGodelet, not really. Unicode code points are mapped only to bytes by a Unicode translation format. For the example above, the Unicode code point u+0001 is represented by the byte 0x01 in some translation formats. So technically, when manipulating a binary chunk, you could figure out what combination of code point and translation format would map to the binary sequence you want to insert - if there is such a combination. Hardly semantics. :)

2018年09月26日00分12秒

well but the OP is operating on a string already. SO he should hopefully not put binary data into a string to start with. And as the .NET string is using UTF-16, the \u0001 is a valid byte sequence describing the very same ASCII control character.

2018年09月25日00分12秒

SebastianGodelet, the OP is only technically operating on a string. What they're really trying to do is put binary data into a string, for example the value "0x01". For <TAG2>, the OP would put in 0x02, and so on. (On a side note, the fact that .NET uses UTF-16 internally isn't relevant here - the OP's example will do what you say because of how Convert.ToChar() works, treating the argument as a Unicode code point number.)

2018年09月26日00分12秒