StreamWriter problem - 2 spaces written as Hex '20 c2 a0 'instead of Hex '20 20'

I write a bunch of strings to a file using a string writer, but I found a problem when I look at a file created in hexadecimal, and it is that one of the spaces (x20) is replaced by (xc2 a0) when there are two spaces separating the words. I do not know if this is very important, but I would like to know if there is an easy solution to this?

Here is what I see:

20 c2 a0 53 57 45 45 50 Dump = "  SWEEP"

But I would always like to:

20 20 53 57 45 45 50    Dump = "  SWEEP"

Note that c2 a0 is not visible here, but the dump looks something like this: "A." when I use the Notepad ++ Hex plugin.

Does anyone have any ideas?

Greetings and thanks in advancement;

-Daver

+5
source share
1 answer

, .

string sourceString = ..some string...
sourceString = sourceString.Replace((char)160, ' '); //replace nobr with space
+5

All Articles