开发者

Problem regarding sql server to store hindi mangal devnagari font. Its showing square boxes when I try to insert the value

I am working with an module of NLP (Natural 开发者_运维知识库Language Processing). For that, I need to store hindi characters in to SQL Server 2005 table. For this, I am using c# as the frontend programming.

At first, I need to know whether the SQL Server stores the hindi characters in a table or not. So I am directly with out c# trying to store hindi characters into table using the Insert queries but its storing square boxes in the database.

I am using Mangal devnagri font for hindi fonts.

The datatype of the table columns is nvarchar(50). The collation is the default one i.e. 'SQL_Latin_General_....'. I have tried too much googling on this from many days but I am not able to find a satisfactory help.


I assume that you see the square boxes in SQL Server Management Studio. This is likely due to the wrong font being used for display there, and not necessarily a problem of the data being stored.

When you query the DB from your application and read the values, you should get the correct unicode representation back, so that no information is lost.

Make sure that you pass in data as nvarchar in parametrized queries (and if you pass literal strings, do prefix them with a "N", like so: SET @s = N'My String').


You'll have to use another collation. Try a specific one meant for hindi characters. If you can't find any available, use a generic unicode/utf-8 one. I'm not using MSSQL, so you'll have to find the correct setting yourself (or wait for another reply). For mySQL I'd use the collation utf8_general_ci. Setting the collation to something "latin" essentially means it will be able to hold standard latin characters (e.g. A-Z) as well as some variants like ä, ó or û but it most likely won't be able to accept many non-latin characters.

Try Lucero's approach above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜