Web Hosting Talk







View Full Version : problem with cyrillic characters in sql server 2005


us0r
05-07-2008, 10:39 AM
Hi,

I have been banging away at this for a few days now and cant seem to find anything to help me on the net.

I need to be able to use russian characters for names and such in my database so I created a table and set my collation to Cyrillic_General_BIN for each field that needs the chars and "Name" field to nvarchar(100).

when I try to use my asp.net code i get ?????s in the database so I tried to insert manually and it works fine. when I set a variable in the database and try to run it i still get the ?'s so its not a .net thing. for my test I did 2 fields.

here is what I did:

declare @name nvarchar(100)
set @name = 'советских солдат'
insert into profile(Name, City) VALUES (N''+@name+'', N'ких')

(1 row(s) affected)

when I select name field is ?'s and city field is fine:

16 ????????? ?????? ких

can someone please help?

Geetha
05-08-2008, 12:43 PM
Hi Ryan,

For this you must include a meta tag in your script

Well, I have 3 different types of Russian Character set codes, make use of a feasible one


Character set
--------------
(1) ISO-8859-5 character set

<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=iso-8859-5">
<META HTTP-EQUIV="Content-language" CONTENT="ru">



(2) KOI-8

<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=koi8">
<META HTTP-EQUIV="Content-language" CONTENT="ru">

(3) MS-Windows

<HEAD>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=cp1251">
<META HTTP-EQUIV="Content-language" CONTENT="ru">

us0r
05-09-2008, 03:40 AM
well when I run this even in management studio with the variables it still does not work let alone on the page:

declare @name nvarchar(100)
set @name = 'советских солдат'
insert into profile(Name, City) VALUES (N''+@name+'', N'ких')

Geetha
05-09-2008, 04:13 AM
Hi Ryan,

Problem is you need to find correct encoding Cyrillic character set. Following encoding will work for most of the Cyrillic characters

<meta http-equiv="content-type" content="text/html;charset=utf-8" />

us0r
05-09-2008, 04:38 AM
<head runat="server">
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=koi8">
<META HTTP-EQUIV="Content-language" CONTENT="ru">

still no go.

any other ideas?

us0r
05-09-2008, 04:41 AM
when i put a break in VS 08 before it calls procedure it is holding the characters just fine.

I think my problem is in SQL Server 05.

Geetha
05-09-2008, 04:47 AM
Hi Ryan,

Just wanted to know whether you mentioned the charset utf-8?