I have a process that essentially works like this:
- MyText is inserted into textbox in MainForm.asp
- MainForm.asp OnSubmit redirects to Submit.asp
- In Submit.asp:
<% myText = Upload.Form("MyText") %>
myText = #<%=myText%>
<% myText = FixQuotes(myText) %>
- myText is inserted into a sql database
- View.asp calls myText from the database
- View.asp prints myText
I'm running into a problem where smart quotes (curly quotes, where there's a difference between a beginning quote and end quotes) are printing as gibberish characters like “
by the time we get to step 6.
I believe that the smart quotes still exist as themselves and not the gibberish by the time we get to step 3, and so I am attempting to use the following function to fix the quotes to straight quotes. I'm not sure exactly what my parameters for the Replace()
should be, so an extra set of eyes would be helpful. What I currently have doesn't actually work.
Function FixQuotes (tempString)
tempString = Replace(tempString, ChrW(&H201c), ""e") 'double left quote
tempString = Replace(tempString, ChrW(&H201d), """") 'double right quote
FixQuotes = tempString
end function
However, it is quite possible that the quotes turn to the gibberish as soon as MainForm submits. In which case, I'm not really sure how I should handle the replacement.
For reference, I have <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
in the heads of all my pages.
Edit: Additional information