Re: Escape character problem
I don't think by just reading into string the escape chars would get added, I suspect that it is stored in DB that way.
Re: Escape character problem
Quote:
Originally Posted by
shuvo
Where I retrieve it and store in tha string variable it becomes
"\\\\Images\\Sunset.jpg";
How are you checking for this.
If you just look at variable with debugger, it always escapes it (even if you originally used @ char). If you are watching this through debugger, content is ok.
Put variable into TextBox or something similar, and you will see it without escaping.
Re: Escape character problem
just because the string's value is
Code:
"\\\\Images\\Whatever"
When you're debugging, the printed value when you output it to the console or a textbox for example will still be
EDIT: D'oh, beaten to the punch! :)
Re: Escape character problem
Thanks to all of you for your input.I found out that url is still working with "\\\\", that is returned from the database. I just had to replace the last "\\" with a "/".Seriously .net should improves its handling of escape characters.
Re: Escape character problem
Having to replace a backslash with a forward slash has nothing to do with .NET escape characters though ...
Re: Escape character problem
@Foamy...Try replacing "\\" with "\".;)
Re: Escape character problem
I'm not sure what you mean... I single backslash will appear as "\\" in C# since it doubles as an escape character, so it needs to be escaped. Two backslashes will therefore appear as "\\\\".
This can be avoided by appending a @ to the front of the string like this:
Code:
string path = @"C:\Program Files\...";