I'm writing a bunch of strings to a file using a string writer but I've discovered a problem when I look at the file created in hex, and that is that one of the spaces (x20) is replaced with a non-breaking space instead (xc2 a0) when there are 2 spaces separating words. I don't know if this is a big deal but I would like to know if there is an easy resolution to this?
Here's what I'm seeing:
20 c2 a0 53 57 45 45 50 Dump = " SWEEP"
But I would like it to always be:
20 20 53 57 45 45 50 Dump = " SWEEP"
Note that the c2 a0 aren't visible here but the dump looks something like 'A.' when I use the Notepad++ Hex Plugin.
Does anyone have any ideas?
Cheers and Thanks In Advance;
-Daver
If your source contains non-breaking spaces you can replace them before writing out the string.
string sourceString = ..some string...
sourceString = sourceString.Replace((char)160, ' '); //replace nobr with space
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With