I have an application which is developed using C#. I am using a third party API (Telnore Corporate SMS) for sending SMS to users. When I write my message in English (I am using a textbox for writing SMS) then the message delivered to mobile is fine and readable. But when I use the Urdu language instead, then it becomes something unreadable:
I consulted multiple tutorials and techniques of UTF-8 encoding, etc., but when I used the UTF-8 encoding the delivered message still wasn't readable (everything turned to question marks in this case).
This is what I have tried so far.
string s = themessage.Text;//themessage is my textbox name
//utf8
byte[] utf = System.Text.Encoding.UTF8.GetBytes(s);
string s2 = System.Text.Encoding.UTF8.GetString(utf);
//ASCII
byte[] utf = System.Text.Encoding.ASCII.GetBytes(s);
string s2 = System.Text.Encoding.ASCII.GetString(utf);
//Unicode
byte[] utf = System.Text.Encoding.Unicode.GetBytes(s);
string s2 = System.Text.Encoding.Unicode.GetString(utf);
I don't know what I am doing wrong. After getting the string s2
I am passing it to a method that is sending the message.