Question : INSERT/UPDATE corrupted data being passed...

IIS | ASP | VBScript | SQL Server 2000 | IE6

Hi,

I'm having a real problem with a CMS that I'm developing. When using add and update web forms I find that the data being passed to the SQL statement is slightly corrupted. It seems to be special characters that are affected such as £$&

I have written a small function which converts special characters into their respective HTML escape codes Eg: £ = £

The SQL statement is built up like so:-

      sqlUpdate = sqlUpdate & "CoSummary = '" & strToSQL(Request.Form("CoSummary")) & "', "

So, when I enter the following test data from a textarea:

"summary"
£ 3
&%&
'lo'

The following is being put in the SQL statement

[snippet]
CoSummary = '"summary"
£ 3
&%&
'lo'',
[end of snippet]

Note the  which has magically appeared infront of £

I have the following page content type : text/html; charset=utf-8

Any help would REALLY be appreciated as I was hoping the function I wrote would solve the problem - its even worse without the strToSQL function.

Thanks,

Rich

Answer : INSERT/UPDATE corrupted data being passed...

You need to change the CharSet in the Metatag to:

META http-equiv=Content-Type content="text/html; charset=iso-8859-1"

This is the English character set.
Random Solutions  
 
programming4us programming4us