Special (or foreign countries) characters

I am new to C # and experimented with ASP.NET GridView (framework 3.5), and I found a big problem when the gridView text contains the following:

ñ / Ñ / á / Á / é / É / í / Í / ó / Ó / ú / Ú or â, ê, î, ô, û, ë, ï, ü or even ç

As a result, the results are displayed like this: &+#+237

I made a mixture of pain by running a table, a data set, etc., to clear the data from the database as the letter itself. I also tried to make a method that cleared variables, but it was a terrible IF.

I was wondering if there is a way for the letters to appear as themselves (like - not like & + # + 237) when retrieving data from a gridview, not getting data directly from the database and not making a lot of code. If this does not happen, is there a way to effectively clean them?

+4
source share
1 answer

Your characters are encoded in HTML, either somewhere at your data access level, or in gridview controls. Try running the text through HttpUtility.HtmlDecode() before linking the grid.

If this does not work, it may be encoded at the control level. I see that you marked this question with a "text box." The standard ASP.NET TextBox control automatically encodes everything that is assigned to its Text property. Instead, you can use the generic System.Web.UI.HtmlControls.HtmlTextArea control or the new HtmlGenericControl("input") .

+5
source

All Articles