1

I am using DNN 7 text editor control to pass text to my Stored Procedure:

Cmd.Parameters.Add(new SqlParameter("@Title", SqlDbType.NText)).Value = txtMsgTitle.Text; Cmd.Parameters.Add(new SqlParameter("@Body", SqlDbType.NText)).Value = teMsgBody.Text;

Before insert/update I have to replace all the html codes like '&aacute ;', '&agrave ;' (please remove spaces) with the equivalent Unicode characters 'á','à' so that when I enter some text to search, it can return correct result for me.

Has anyone got a better solution for this? I have to do the replace many times (say 20 characters) something similar to this link but not that complicated: http://www.stormrage.com/SQLStuff/XML_To_ASCII.txt

Blue Bamboo
  • 147
  • 3
  • 13
  • Possible duplicate of [Decoding all HTML Entities](https://stackoverflow.com/questions/8348879/decoding-all-html-entities) – Andrew Morton Aug 22 '18 at 15:01

1 Answers1

0

Try to put a 'N' before the value entered in database. Here is the SQL Fiddle.

http://sqlfiddle.com/#!3/39575/1

You can check the code. Hope this will solve your problem.

Ankit Bajpai
  • 13,128
  • 4
  • 25
  • 40