开发者

Binary String to ASCII TEXT String [duplicate]

开发者 https://www.devze.com 2023-03-06 05:23 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Binary To Corresponding ASCII String Conversion
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Binary To Corresponding ASCII String Conversion

I posted a slimier question before but didn't got a correct answer..

my problem is i have a binary string as

00100000011101110110000101101110011101000010000001110100011011110010000开发者_如何学运维001100100011011110111

Which im required to convert to "Normal ASCII String Text"

I used BinaryReader and read and encode System.Text.ASCIIEncoding.ASCII but im getting the same 0101010 string

    byte[] bytearray = b.ReadBytes((int)length);

    System.Text.Encoding encEncoder = System.Text.ASCIIEncoding.ASCII;

    string bb = encEncoder.GetString(bytearray);

any help will be grateful !


first translate the binary string into a byte[] using How could I encode a string of 1s and 0s for transport?

next use the Convert.ToBase64String method to get the actual System.String

0

精彩评论

暂无评论...
验证码 换一张
取 消