Special characters are not posted on wall


#1

if i tweet normal string, it is going on an account. When i put any special characters like ( ) * ’ in the message, message is not tweeted on an account.
Please let me as soon as possible. My code is not working for it.
Code is:

HttpWebRequest request = CreateWebRequest(_updateUri);
if (request != null)
{
request.Method = httpAction;
request.ContentType = “application/x-www-form-urlencoded”;
request.UserAgent = “Sie_BT/1.0”;

                // Tell Twitter we don't do the 100 continue thing
                request.ServicePoint.Expect100Continue = false;

                request.Headers.Add("Authorization", GetAuthHeader());
            
                string postBody = "status=" + Uri.EscapeDataString(tweetIn);
            
                using (Stream stream = request.GetRequestStream())
                {
                    byte[] bodyBytes = Encoding.ASCII.GetBytes(postBody);
                    stream.Write(bodyBytes, 0, bodyBytes.Length);
                }

                Trace.Debug("PostTweet(): Sending message to Device : {0} and Message : {1}", DeviceDpName, request.ToString());
                WebResponse response = request.GetResponse();

                Stream responseStream = response.GetResponseStream();
                if (responseStream != null)
                {
                    StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8);
                    readStream.ReadToEnd();

                    // ToDo: verify responseStr value then assign messageOperationReturnCode accordingly 
                    retVal = (int)MessageOperationReturnCodes.Success;
                }

                response.Close();
            }

#2

Have you checked your GetAuthHeader() method to ensure that it properly encodes the parameters?


#3

Except these characters, other characters are encoded properly. Also i tried to send hexadecimal value of these characters for encoding, but it gives “The remote server returned an error: (401) Unauthorized.”. Please let me know anyone has a solution.