0

I am assigning Urdu text to a variable in c# and inserting it into database (SendMessages table), it saves Urdu message perfectly without any modification, great but when that message is received in any mobile handset then it appears as ??????????????????????, why ? i checked it with all urdu compatible handsets which receive other urdu messages perfectly but not this one.

Code asp.net:

String MessageLanguage= Convert.ToString(ViewState["LanguageCode"]); //

                        if (MessageLanguage == "ur")
                        {
                            String UrduMsg = ComplaintCode +" "+"اپکی سثیکایت درج کردی گیؑ ھے۔ سثیکایت کوڈ یہ ہے";
                            quebiz.Insert(lblContact.Text, UrduMsg, null, Convert.ToInt32(lblComplainantID.Text), null, null);
                            ViewState["LanguageCode"] = null;

                        }

In simple words, urdu message being passed from C# into sql table is fine and perfect, not problem but after receiving same sms in handset, it doesn't work that way. I tried base64 conversion like

String UrduMsg = ComplaintCode +" "+"اپکی سثیکایت درج کردی گیؑ ھے۔ سثیکایت کوڈ یہ ہے";
                            var UrduMsgBytes = System.Text.Encoding.UTF8.GetBytes(UrduMsg);
                            var Base64EncodedUrduMsg = Convert.ToBase64String(UrduMsgBytes);

but it resulted in saving a long string in database like it is rendering yu98yhr9h93h99hd9h9ash9dhas9yr090u0usjaosfhiehhw8hw. Collation on column is ON, column is Nvarchar(1600).
why ? help ? I am using asp.net C#.net 4.0 with sql server 2014.

John Nash
  • 155
  • 1
  • 4
  • 12
  • You store string in database and when you read it, ????? will appear? – Ali Sepehri.Kh Sep 09 '14 at 12:18
  • doesn't appear in mobile, just "?????????????????????" marks appear – John Nash Sep 09 '14 at 12:23
  • Are you using **N** to insert your data to SQL Server? I'm not sure but maybe your problem is because of that. – Ali Sepehri.Kh Sep 09 '14 at 12:29
  • For example : `insert into tableName(name) values(N'"+درج کردی+"')` – Ali Sepehri.Kh Sep 09 '14 at 12:30
  • Please don't post duplicate questions. This seems identical to this: http://stackoverflow.com/questions/25720874/urdu-message-sent-from-sql-to-mobile-handset-is-in-unreadable-format You need to follow each question to its conclusion, don't just ask a new one. – Nick.Mc Sep 09 '14 at 13:00

1 Answers1

0

I am not sure but you can try N parameter for Insert command.

For example use:

insert into tableName(name) values(N'"+درج کردی+"')
Ali Sepehri.Kh
  • 2,468
  • 2
  • 18
  • 27
  • yes but how to append N in my case ? like i am trying to put N but it throws syntax error String UrduMsg = ComplaintCode +" "+"اپکی سثیکایت درج کردی گیؑ ھے۔ سثیکایت کوڈ یہ ہے"; how to put in this ? – John Nash Sep 13 '14 at 07:43
  • @JohnNash: What `quebiz` is instance of? Maybe it has a property to set this attribute. – Ali Sepehri.Kh Sep 13 '14 at 12:07
  • it's an instance of a class QueueBizz – John Nash Sep 15 '14 at 06:04
  • @JohnNash Is QueueBizz your custom class? If yes, What is the implementation of Insert method of QueueBizz class? – Ali Sepehri.Kh Sep 16 '14 at 05:15