Replacing special characters for storage in SQL and then output to browser
Posted on 2011-03-22
I have an html form with which the user is creating a title and description of an item. This data is then stored in MS SQL and later retrieved for display in the browser.
The problem is that some users enter names with special characters, such as Spanish names (eg. Pérez or Migüel etc.). There are even instances of users entering open or closed quotes rather than the standard straight quotation marks (probably from cut & pasting from a Word Doc I would guess).
In any event all of these special characters are showing up in the DB exactly as they are entered, but when rendered in the browser they are being displayed as a funky question mark symbol (¿).
I do not want to spend the time writing a replace function to account for all the possible variations of special characters.
How best to handle this? Does anyone have a ready-made classic ASP function or RegExp that I can use to convert the characters to html for storage or some other solution please?
Needs to be in Classic ASP. Thanks.