Fadi
Fadi

Reputation: 191

sql character encoding non English character

i'm using sql 2008 r2 i'm trying to insert some value in arabic language

insert into tbl_number (number_ownerName , number_num ) values ('مديرية الزراعة/التقانة','235767')
insert into tbl_number (number_ownerName , number_num) values ('محمد  راتب ابازيد','227927')
insert into tbl_number (number_ownerName , number_num) values ('فادي مصطفى ابازيد','221355')

but the result look like :

select * from tbl_number
number_num            number_ownerName 
235767          ?????? ???????/??????? 
227927                  ????  ???? ??????    
221355                  ???? ????? ??????     

Upvotes: 2

Views: 2657

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172418

I think you are looking for NCHAR which is NATIONAL CHAR that is stored as UTF-16LE and is the only way to reliably store non-ASCII characters.

Fixed-length Unicode string data. n defines the string length and must be a value from 1 through 4,000. The storage size is two times n bytes. When the collation code page uses double-byte characters, the storage size is still n bytes. Depending on the string, the storage size of n bytes can be less than the value specified for n. The ISO synonyms for nchar are national char and national character..

Also note that SQL Server has no support for UTF-8.

Also check

EDIT:-

As commented, you can add N while you are inserting. Try like this:

insert into tbl_number (number_ownerName , number_num ) values (N'مديرية الزراعة/التقانة','235767') 
insert into tbl_number (number_ownerName , number_num) values (N'محمد راتب ابازيد','227927') 
insert into tbl_number (number_ownerName , number_num) values (N'فادي مصطفى ابازيد','221355')

Upvotes: 2

Related Questions