Ask a Question related to ASP.NET General, Design and Development.
-
Sasha Shevelev #1
Re: Displaying Charset windows-1251
Sorry, If I was unclear. I was tired after a long 2 days of trying to solve
this problem.
I am using SQL server 2000 to store my data.
My data is stored as NVarchar, which I know is unicode.
There are 2 ways to get russian characters from an NVarchar field in SQL
Server.
1) Insert data without N' prefix so russian looks something like this in
the DB - Среда. (I notice this shows up identically in the posting).
2) Use the N' Prefix so the data looks exactly like russian in the DB.
Example: UPDATE Table1 SET Col1 = N'New Text' WHERE id = 1000
My problem is the first way works 100% correctly in Classic ASP.
All I have to do for data to appear correctly through a browser is add the
metatag
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> .
view [url]http://test.roomrez.com/lookscorrect.asp[/url]
Unfortunately i need to integrate classic ASP with new dot net code which
does not like the way the data is stored in the DB.
Data in ASP.net is displayed as heiroglyphics even with the metatag.
For this project I can not convert my data in the database because it would
mean rewriting alot of code in classic asp. And besides it is is working and
I can't see why it is so complicated in dot net.
I have tried the following Dot net functions..'Thread.CurrentThread.CurrentCulture => > response.charset = "windows-1251"
> > Response.ContentEncoding = "windows-1251"
> > Session.CodePage = 1251
CultureInfo.CreateSpecificCulture("ru")
'Thread.CurrentThread.CurrentUICulture = New CultureInfo("ru")
To sum up what I need is a process that somewhere between by database and
the users browser converts my data into proper russian.
To simulate my problem you can do this...
1) Create the table
CREATE TABLE [dbo].[WordTranslation] (
[WordID] [int] NOT NULL ,
[LanguageID] [int] NOT NULL ,
[Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Modified] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[WordTranslation] WITH NOCHECK ADD
CONSTRAINT [DF_WordTranslation_Modified] DEFAULT (getdate()) FOR
[Modified],
CONSTRAINT [PK_WordTranslation] PRIMARY KEY NONCLUSTERED
(
[WordID],
[LanguageID]
) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
2. Populate data
Go to [url]http://test.roomrez.com/test4.asp[/url] and copy some of the inserts into
SQL Query analyzer.
(Ignore the fact the text looks like heiroglyphs through this page, view
[url]http://test.roomrez.com/lookscorrect.asp[/url] if you want to see the same page
but with the correct metatag)
3) Try and display this data through a browser using asp.net.
Cheers,
Sasha Shevelev
"Sasha Shevelev" <sashshev@bigpond.net.au> wrote in message
news:#ZAHA58PDHA.2248@TK2MSFTNGP11.phx.gbl...features> Hi there,
>
> I was hoping someone may have played around with the globalizationI> in asp.net.
>
> I am trying to display data from SQL as charset- 1251 which is cyrillic.
>
> So what looks like this in SQL - "Среда" needs to look like this in the
> browser - "?????".
>
> This is easily achieved in Classic asp by using the metatag <meta
> http-equiv="Content-Type" content="text/html; charset=windows-1251"> .
>
> Dot net for some reason displays the data exactly as it appears in the DB.in> have tried converting everything to UTF-8 and that works in dot net but
> ruins my existing classic asp functionallity
>
> I don't want to convert the DB data, I just want it to display as it did> Classic ASP.
>
> I have also played with
> response.charset
> Response.ContentEncoding = "windows-1251"
> Session.CodePage = 1251
>
> If anyone has a function that will do the conversion I would be much
> obliged. Especially if the example is in VB
>
> Any ideas??
>
> Cheers,
> Sasha
>
>
Sasha Shevelev Guest
-
problem displaying flash properly in firefox for windows
:confused; my coworker and i are in serious need for some help. we're making a product in flash and it shows up perfectly in firefox in safari... -
1251 Client does not support authentication
Not sure why this error is coming up when I try to connect to a MYSQL database. I am running Apache2, PHP4, MYSQL4.1 on windows xp home. I am... -
displaying new windows without the toolbars
Are you using an extension to create the new pop up windows? If so most of them allow you to choose wich features to have or delete. Always... -
Subforms not displaying on Windows 98
Hello, I recently loaded an application on a PC that uses Windows 98, and none of the subforms display. Can someone help me find what's wrong? ... -
Problem displaying linux console from Windows 2k
Hi I am a newbie and I installed a headless server next to my Windows 2K computer in order to learn better about Linux. My problem is as...



Reply With Quote

