I know this problem is almost as old as a world and thousands of answers exists in the web, but I still cannot find what is a problem in my case and why characters shows as black question marks (�) :(
We have a multilingual site that currently supports 10 languages. Some characters are displayed incorrectly (ве��сией, 联合国���际). It can happen with regular characters in non Latin languages, and in other words on same page, the same characters are displayed correctly. In Latin languages, all special and regular characters are displayed correctly.
I tried to play with encoding, but when in one place it fixes the problem the problem appears in other place.
Here, how my encodings configured:
1) In MS SQL Server, we use NVARCHAR(MAX) column with SQL_Latin1_General_CP1_CI_AS
collation.
2) In web application, in web.config file I have: <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
.
3) On page itself, we have <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
.
In response headers, Chrome shows: Content-Type:text/html; charset=utf-8
.
What I miss? Why I still see those black question marks? What should I check/change in order to display all characters correctly.
Thanks
UPDATE
I found a problem and it is totally not related to transport encoding. I thought the problem is with encoding, in way how it passes DB -> ASP.NET -> Browser, but after lots of debugging, I found that the problem is in way, how the output has been written to HttpContext.Current.Response.Filter
....we have our custom filter, and somehow, the buffer (byte[]
) that was passed to the Write method of filter. It has corrupted array of Unicode string, so sometimes the last char of the string in bytes, was translated as gibberish. I still not found how to solve it correctly, but for now, i can disable our filter and there is no question marks any more.
Thanks to all.