问题描述
我遇到编码字符串的问题...这里是我的代码:
byte [] s = System.Text.Encoding.ASCII.GetBytes (FieldContent);
现在,这个工作正常,只要没有超过128的字节,对于
例子,一个0x99字节结果作为0x3f字节。
我知道ASCII只是7位,但我尝试了其他编码格式,
并且他们没有得到我所需要的东西.. UTF7做了与ASCII相同的事情,
UTF8为每个0x99字节提供了0xC299,而UNICODE给出了很好的结果,但是在
unicode格式中。
我做错了什么?
Miki
I''m having a problem with encoding a string... here''s my code:
byte[] s = System.Text.Encoding.ASCII.GetBytes(FieldContent);
Now, this works fine, as long as there are no bytes that are over 128, for
example, a 0x99 byte turns out as 0x3f byte.
I know that ASCII is just 7 bits, but i tried the other encoding formats,
and they didn''t get me what i needed... UTF7 did the same thing as ASCII,
UTF8 gave 0xC299 for each 0x99 byte, and UNICODE gave good results, but in
unicode format.
What am i doing wrong?
Miki
这篇关于奇数字符串编码行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!