Reputation: 19
I'm trying to move some old classic ASP website to Azure App Service. The webpages work fine, but show national characters from varchar
columns as question marks.
How to reproduce:
Create a SQL Server database (on Azure or on other SQL Server) with Cyrillic_General_100_CI_AS collation
Create the table with varchar
and nvarchar
columns:
create table dbo.Test
(
id int identity (1,1) not null,
code varchar(255) null,
name nvarchar(255) null
)
Insert some test data:
insert dbo.Test (code, name)
values ('привет-1', N'привет-2')
insert dbo.Test (code, name)
values ('привет-3', N'привет-4')
Ensure that data is selected fine in SSMS:
select * from dbo.Test:
id code name
1 привет-1 привет-2
2 привет-3 привет-4
Create a webpage that displays data:
id code name
1 ??????-1 привет-2
2 ??????-3 привет-4
So, the nvarchar
columns show up fine, but varchar
columns do not. Using the following code on the Azure web page doesn't help:
Response.CharSet = "windows-1251"
Response.CodePage = 1251
Session.CodePage = 1251
On "regular" IIS everything is shown fine - maybe because it has "ASP encoding" setting. Anybody knows how to fix that on Azure?
Thanks in advance
Upvotes: 1
Views: 594
Reputation: 3293
The best solution is to change varchar to nvarchar as marc_s said. If it is not a good solution for you, please try to set Collation as "Cyrillic_General_CI_AS" when creating your Azure SQL Database. Refer to this article for more detailed information.
Here is my result: (just create a mvc controller with view using Entity framework)
Upvotes: 1