asp-classicvbscriptiis-5windows-server-2000smart-quotes

How could ASP server-side code corrupt a smart quote ’?


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?


Solution

  • 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:

    Response.Write Request.Form("selOptions")(0) ' A-OK! - Displays Unicode characters fine!  
    For Each sOption in Request.Form("selOptions")
      Response.Write sOption ' Bad! Unicode characters are mangled!  
    Next
    

    As always, your mileage may vary.