0

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

00100000011101110110000101101110011101000010000001110100011011110010000001100100011011110111

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 !

Community
  • 1
  • 1
Sudantha
  • 15,684
  • 43
  • 105
  • 161

1 Answers1

1

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

Community
  • 1
  • 1
Mihai Oprea
  • 2,051
  • 3
  • 21
  • 39