本文介绍了ASCIIEncoding在Windows Phone 7的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有在Windows中使用ASCIIEncoding办法Phone 7的?
Is there a way to use ASCIIEncoding in Windows Phone 7?
除非我做错事 Encoding.ASCII
不存在,我需要它的C# - > PHP加密(如PHP只能在SHA1使用ASCII加密)。
Unless I'm doing something wrong Encoding.ASCII
doesn't exist and I'm needing it for C# -> PHP encryption (as PHP only uses ASCII in SHA1 encryption).
有什么建议?
推荐答案
这是很容易实现自己,统一code从不与ASCII codeS搞砸:
It is easy to implement yourself, Unicode never messed with the ASCII codes:
public static byte[] StringToAscii(string s) {
byte[] retval = new byte[s.Length];
for (int ix = 0; ix < s.Length; ++ix) {
char ch = s[ix];
if (ch <= 0x7f) retval[ix] = (byte)ch;
else retval[ix] = (byte)'?';
}
return retval;
}
这篇关于ASCIIEncoding在Windows Phone 7的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!