My company just converted many columns from varchar to nvarchar.
Now it seems that when we render a smart quote (i.e. ALT+0146 ’) to the screen and then send it back to the SQL Server 2000 database for persistence, the smart quote gets corrupted to - ’ -.
My Question:
How could ASP server-side code corrupt a smart quote ’ ?
EDIT: It appears that my question is similar to this one. Incidentally, Powerpoint content introduced the smart quote into the mix. However as I said before, I'm dealing with an ASP page, whereas the referenced question pertains to a PHP page.
EDIT: The server-side directive CODEPAGE=65001
makes the page render correctly, but it still posts content as 'Western European' on a Windows 2000 box. Does anyone know why?
It looks like something is doing an implicit conversion between ANSI and Unicode (and choosing the wrong code page in the process). You may need to do the conversion manually and supply the correct code page. It's hard to say without seeing the code.
While you do need to tell the server which encoding to use, have you told the client what the page encoding is? If not, the client will happily post in whatever encoding the user last explicitly chose, or a system default encoding, which is likely to be western european on most US or Western European machines.
In your html, do you have something like this in your <head> ?
You can also ask the server to send this explicitly in your Response.Headers. Although I think it's a good idea to send it in the HTTP headers, it's helpful to include it in the HTML as well for people who decide to save the document locally for whatever reason.
VBScript might mangle the Unicode characters; especially on older versions of IIS (i.e IIS 5.0 on Windows Server 2000).
In my case, a
For Each
construct was to blame.Here's some example code that executes after a POST:
As always, your mileage may vary.
Take a look at this:
http://support.microsoft.com/kb/232580
You may want to set your Code Page in the ASP so you don't get hokey characters.