二进制字符串ASCII文本字符串 [英] Binary String to ASCII TEXT String
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/6006425/binary-to-corresponding-ascii-string-conversion\">Binary为了对应的ASCII字符串转换
块引用>我之前发布了slimier的问题,但没有得到一个正确的答案。
我的问题是,我有一个二进制字符串作为
<$p$p><$c$c>00100000011101110110000101101110011101000010000001110100011011110010000001100100011011110111
这需要即时通讯转换为
普通的ASCII字符串文本
我用
BinaryReader
和阅读并设有codeSystem.Text.ASCIIEncoding.ASCII
,但即时得到同样0101010
字符串字节[]字节组= b.ReadBytes((int)的长度); System.Text.Encoding encEn codeR = System.Text.ASCIIEncoding.ASCII; 字符串BB = encEn coder.GetString(ByteArray的);
任何帮助将不胜感激!
解决方案首先转换二进制字符串转换为
字节[]
使用<一个href=\"http://stackoverflow.com/questions/3935524/how-could-i-en$c$c-a-string-of-1s-and-0s-for-transport\">How我可以带code 1和0运输的字符串?接下来使用 Convert.ToBase64String 方法得到实际
System.String
Possible Duplicate:
Binary To Corresponding ASCII String ConversionI 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 encodeSystem.Text.ASCIIEncoding.ASCII
but im getting the same0101010
stringbyte[] 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
这篇关于二进制字符串ASCII文本字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!