POST status update to Twitter from WINPRT returns 401 when containing special characters


I am trying to solve my problem for some time now, but I’m running out of ideas.

I am using the following method to send a status update to Twitter via POST:

private async void PostStatusUpdateToTwitter(string text) { String TwitterUrl = "";
        string timeStamp = GetTimeStamp();
        string nonce = GetNonce();

        String SigBaseStringParams = MyUrlEncoder.UrlEncode("oauth_consumer_key=" + TwitterConsumerKey);
        SigBaseStringParams += MyUrlEncoder.UrlEncode("&oauth_nonce=" + nonce);
        SigBaseStringParams += MyUrlEncoder.UrlEncode("&oauth_signature_method=HMAC-SHA1");
        SigBaseStringParams += MyUrlEncoder.UrlEncode("&oauth_timestamp=" + timeStamp);
        SigBaseStringParams += MyUrlEncoder.UrlEncode("&oauth_token=" + App.SettingsStore.TwitteroAuthToken);
        SigBaseStringParams += MyUrlEncoder.UrlEncode("&oauth_version=1.0");
        SigBaseStringParams += MyUrlEncoder.UrlEncode("&status=") + MyUrlEncoder.UrlEncodeWith25(text);
        String SigBaseString = "POST&";
        SigBaseString += MyUrlEncoder.UrlEncode(TwitterUrl) + "&" + SigBaseStringParams;

        String Signature = GetSignature(SigBaseString, TwitterConsumerSecret, App.SettingsStore.TwitteroAuthTokenSecret);

        HttpStringContent httpContent = new HttpStringContent("status=" + text);
        httpContent.Headers.ContentType = HttpMediaTypeHeaderValue.Parse("application/x-www-form-urlencoded");
        string authorizationHeaderParams = "oauth_consumer_key=\"" + TwitterConsumerKey + "\", oauth_nonce=\"" + nonce + "\", oauth_signature=\"" + MyUrlEncoder.UrlEncode(Signature) + "\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"" + timeStamp + "\", oauth_token=\"" + MyUrlEncoder.UrlEncode(App.SettingsStore.TwitteroAuthToken) + "\", oauth_version=\"1.0\"";

        HttpClient httpClient = new HttpClient();

        httpClient.DefaultRequestHeaders.Authorization = new HttpCredentialsHeaderValue("OAuth", authorizationHeaderParams);

        var httpResponseMessage = await httpClient.PostAsync(new Uri(TwitterUrl), httpContent);
        if (httpResponseMessage.IsSuccessStatusCode)
            string response = await httpResponseMessage.Content.ReadAsStringAsync();
        else if (!httpResponseMessage.IsSuccessStatusCode)
            MessageDialog twitterPostErrorMsg = new MessageDialog(string.Format("there was a problem posting your tweet: \n\nStatuscode: {0} \n\nMessage: {1}", httpResponseMessage.StatusCode, httpResponseMessage.Content), "Sorry,");
            await twitterPostErrorMsg.ShowAsync();

My problem: if I do send a status update that contains only plain text without characters that need encoding, they get posted. As soon as I am adding characters that need encoding, Twitter returns a 401 statuscode with a reference to their error code 32 (Your call could not be completed as dialed.) and sending the status update failed.

I compared the signature my code creates as well as the Authorization Headers, they are absolutely equal with the code above:

Twitter API Console:


My app:


Authorization Header
Twitter API Console:

oauth_consumer_key="XXXX", oauth_nonce="1a53364d16df21a7d63bd61f3b65bab8", oauth_signature="hCXHS4hVUN7ukvzJWpuu29hMEP4%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1397880971", oauth_token="XXXX", oauth_version="1.0"

My app:

oauth_consumer_key="XXXX", oauth_nonce="yrjczyygulkfffetxfwjypmhwqarjgcw", oauth_signature="1rloh0bHFiE3M7VhJ30%2B5fWEIVg%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1397916317", oauth_token="XXXX", oauth_version="1.0"

really don’t know what I can try else, as the encoding here is correct and without the symbol characters all works well.

Thanks in advance for any idea.