byte [] test = Form1.StrToByteArray(「simpletext」); string encoded_text = BitConverter.ToString(test).Replace(「 - 」,「」).ToLowerInvariant(); textBox1.Text = encoded_text; // 73696d706c6574657874如何重新編碼回來? BitConverter
從這行「73696d706c6574657874」中取回「simpletext」?
// StrToByteArray()
public static byte[] StrToByteArray(string str)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);
}
THX的人,但我可以使用ASCII代碼,因爲http://stackoverflow.com/questions/2305676/problems-understanding-an-open -source-blowfish-api 這裏我有string dec =「A-ґР^ E - 」; // asdasdas - 這個文本 並且必須收到「asdasdas」,但是我得到了「3?} Fg5 ??」,因爲我使用ASCII – Alex 2010-02-22 07:39:47
@Alex:實際上,該文章顯示包含*非ASCII *字符的「dec」...您是否真的很樂意使用非常有損耗的轉換? – 2010-02-22 07:41:46
那我怎麼辦? – Alex 2010-02-22 07:46:38