views:

32

answers:

2

I wrote a small .NET applications that removes all line breaks in aspx/html/css code to make it harder to read for people trying to steal my design. And surprisingly I get weird characters that appear out of nowhere such as Â, » and others. They all stay at the same places, but I have no clue why they appear.

Do you have any ideas on how to fix this?

+1  A: 

Are you removing the both the carriage return and linefeed characters? Windows uses 2 line break characters for each line break.

Kendrick
So it should be "\r\n" instead of just "\n", right?
Alex
I think that will work, but you might want to use Environment.NewLine as perhaps the safest option.
Kendrick
+2  A: 

I'm not sure on why you're getting the issue based on the information you've provided, but if I were you I probably wouldn't spend too much time working on this: if you're just removing white space, someone could just simply paste your code into visual studio and hit the format button to bring it all back.

If you need it regardless, there are libraries out there that do just this, but they are mainly intended to compress what's sent to the clients.

Example: http://madskristensen.net/post/Remove-whitespace-from-your-ASPNET-page.aspx

John
By the way, what's the "format button"?
Alex
Edit->Advanced->Format Document
John