views:

64

answers:

1

Hi,

My code below seems to be encoding special charcters how do I get it to escape these?

 str1 += myGridView.Rows[idx].Cells[2].Text + ";";

When i check the grid view html source the table cell text is = 'http://news.google.co.uk/nwshp?ie=UTF-8&hl=en&tab=wn&q=Clifford+Chance&output=rss'

But the value for str1 is 'http://news.google.co.uk/nwshp?ie=UTF-8&hl=en&tab=wn&q=Clifford+Chance&output=rss;'

Many Thanks,

+5  A: 

What you're seeing here is the HTML control encoding your text to HTML so it appears in the client's browser as it does in your string.

You can use HttpUtility.HtmlDecode(string) to decode an encoded string of HTML.

Programming Hero