-1

I have an international character that shows up in my SQL Server database. When I attempt to display that field on a webpage using Classic ASP, it shows up as a diamond with question mark inside. From my searching, this seems to do with UTF-8 encoding. I have added a META tag to include UTF-8 and that did not work. Below is a screenshot of how the data looks inside my SQL Server Database using the Management Studio, Query. How can I get this to display properly on my webpage?

 <meta charset='utf-8'>

international character

trevoray
  • 317
  • 1
  • 11
  • 28

2 Answers2

0

Turns out that this whole code is what it took to do the trick. It had to be at the top of my page:

 <%
 Session.CodePage = 65001
 Response.charset ="utf-8"
 Session.LCID     = 1033 'en-US

 %>
trevoray
  • 317
  • 1
  • 11
  • 28
  • 1
    You can also use `Response.CodePage` – John Jun 05 '15 at 09:17
  • Using [`Session.CodePage`](https://msdn.microsoft.com/en-us/library/ms525649%28v=vs.90%29.aspx) *(See remarks section)* is dangerous if you haven't made sure that **all** the web applications ASP pages have been saved as `UTF-8` *(in this case)*. Basically your telling IIS to interpret all response as `UTF-8` which also means that all pages have to be saved as `UTF-8` for this to work correctly. – user692942 Jun 08 '15 at 08:39
  • As [@John mentions](http://stackoverflow.com/questions/30646967/international-character-in-my-sql-server-database-does-not-display-on-my-classic#comment49387706_30653030) `Response.CodePage` is better as you only affect the current page not the whole application. Just remember the page is saved as `UTF-8` when you use it. – user692942 Jun 08 '15 at 08:43
0

Just change the first line of the ASP page to include CodePage:

<%@ Language="VBScript" CodePage="65001" %>

CodePage="65001" means UTF-8.

Keith
  • 20,636
  • 11
  • 84
  • 125
  • Is that all? I guess you're assuming the OP knows to make sure the source file matches the `CodePage` directive? Admittedly most editors will default to `UTF-8` now but that's a pretty big assumption. – user692942 Jun 08 '15 at 08:49