Isbah Khan
Isbah Khan

Reputation: 115

Arabic text is not getting saved in database

When i am giving input through TextBox and storing in database like:

"Under ( امارات .) english"

so what is actually getting stored :

 "Under ( ??.?????.) english"

Even i have used datatype as nvarchar(Max).How to resolve it? Please answer me as soon as possible. Thanks.

Upvotes: 1

Views: 3329

Answers (3)

alhusseiny
alhusseiny

Reputation: 11

select projectname then rightclick then proparties then setting then select the conniction string click in column value then choose .... screen connection proparties will appear on this screen choose advanced then choose character and wright utf8 then choose treat blobs as utf8 change value to true all arabic data will transfer will to my sql.

Upvotes: 1

VahidN
VahidN

Reputation: 19156

Try N'Unicode data'

N'Under ( امارات .) english'

instead of simple

'Under ( امارات .) english'

when you are inserting data. N here means national.

Upvotes: 1

deroby
deroby

Reputation: 6002

Hoping this sheds some light on why you need to store this as Unicode (*N*varchar) [as suggested by VahidN] and why this has ABSOLUTELY NOTHING to do with Collation (as (was) suggested elsewhere)

Try the following code:

CREATE TABLE t_test (
                      txt       varchar(1000) COLLATE Latin1_General_BIN,
                      arabic    varchar(1000)   COLLATE Arabic_100_CI_AI_KS_WS,
                      chinese   varchar(1000)   COLLATE Chinese_Simplified_Pinyin_100_CI_AI,
                      ntxt      nvarchar(1000) COLLATE Latin1_General_BIN,
                      narabic   nvarchar(1000)   COLLATE Arabic_100_CI_AI_KS_WS,
                      nchinese  nvarchar(1000)   COLLATE Chinese_Simplified_Pinyin_100_CI_AI,                      
                   )
GO
INSERT t_test (txt, arabic, chinese, ntxt, narabic, nchinese) 
VALUES ('Under ( امارات .) english',
        'Under ( امارات .) english',
        'Under ( امارات .) english',
        N'Under ( امارات .) english',
        N'Under ( امارات .) english',
        N'Under ( امارات .) english')

SELECT * FROM t_test

Upvotes: 1

Related Questions