C # How to remove string characters from binary?

Mostly I have binary data, I do not mind if it is unreadable, but I write it to a file that is being analyzed, and therefore important newline characters are output.

I thought I did the right thing when I jumped to a string ....

byte[] b = (byte[])SubKey.GetValue(v[i]);
s = System.Text.ASCIIEncoding.ASCII.GetString(b);

and then delete the lines of the new line

String t = s.replace("\n","")

but doesn’t work?

+3
source share
5 answers

The new line may be \ r \ n, and your binary data cannot be encoded in ASCII.

+6
source

Firstly, new line ( Environment.Newline) usually has two characters in Windows, do you mean deleting individual carriage return or line characters?

-, . . , ASCII?

0

\n \r \r\n , Linux, Macintosh Windows.

, , , , ASCII ?

, - , .

0

, , , , .

, base64, ASCII- .

0

, ( ), ( ). ( /), .

, . , ( ) , , . , . , ( big-endian/little-endian, ). . , , .

; , ; .

0
source

Source: https://habr.com/ru/post/1747960/


All Articles