I have an ASP page with this in the header:
<%@CodePage=65001 %>
<% response.codepage=65001
response.charset="utf-8" %>
<head>
<meta charset="utf-8">
</head>
I retrieve data from an MS SQL database table (that contains French characters with accents and so forth) via another ASP file, and insert that text into my page dynamically with Javascript, and everything looks perfect.
Note that if I take all of that header code out, it still displays correctly. But my other hard-coded characters on the page (such as “ ” ‘ ’ —, etc) do not display. So I leave the header code in.
I have another "add to cart" ASP file that retrieves the same data and inserts it into a cart table. I temporarily display the data in my script, in order to see what I am inserting, but the text is distorted. For example:
réexpédié
Instead of:
réexpédié
When I check the cart table, it is also distorted there.
If I insert this at the top of my "add to cart" ASP file:
<meta charset="utf-8">
...the display on the screen looks good, but the data stored in the cart table is still distorted. I'm not sure why it looks good on the screen, because in my main ASP file (where I insert the same text) it doesn't matter if I include the meta tag or not.
I am confused as to which parts of my code are causing the text to display correctly and which are causing it to fail.
Even looking at my ASP file that retrieves the data for Javascript to insert, if I load that URL in my browser, the text is incorrect. But when I insert it into the main ASP page, it is correct. If I add the meta tag to the first ASP file, now that is correct. But on the main page, it doesn't matter if I include the meta tag or not.
How can I resolve this so I get consistent text characters in all of these instances?