danielcrenna/hammock — Issue #45: Issue with cyrilic chars when sending statuses/update_with_media twitter API (Windows Phone)
Author: aximus
Created: 2011-10-11 22:51:16+00:00
State: open

Hello
I've found an issue in the latest version of Hammock library for Windows phone

if I add parameters to RestRequest via AddField method, Hammock does not encode (or do it incorrectly - it replaces chars with question marks) value parameter and I can't submit Cyrillic strings (look for a string '#????'):

POST http://upload.twitter.com/1/statuses/update_with_media.xml HTTP/1.1
Accept: */*
Referer: file:///Applications/Install/
Content-Length: 4602
Accept-Encoding: identity
Authorization: OAuth oauth_consumer_key="xxx",oauth_nonce="xxx",oauth_signature="xxx",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1318371513",oauth_token="xxx",oauth_version="1.0"
Content-Type: multipart/form-data; boundary=9d4b909c-4415-4660-89a5-1c0b23ee8c8d
User-Agent: NativeHost
Host: upload.twitter.com
Connection: Keep-Alive
Cache-Control: no-cache
Pragma: no-cache

--9d4b909c-4415-4660-89a5-1c0b23ee8c8d
Content-Disposition: form-data; name="status"

#????
--9d4b909c-4415-4660-89a5-1c0b23ee8c8d
Content-Disposition: form-data; name="media[]"; filename="TweetPhoto.jpg"
Content-Type: image/jpeg

At the same time, if I use AddParameter method, it works well with Cyrillic strings

POST http://api.twitter.com/statuses/update.xml HTTP/1.1
Accept: */*
Referer: file:///Applications/Install/
Content-Length: 34
Accept-Encoding: identity
Authorization: OAuth Authorization: OAuth oauth_consumer_key="xxx",oauth_nonce="xxx",oauth_signature="xxx",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1318371513",oauth_token="xxx",oauth_version="1.0"
Content-Type: application/x-www-form-urlencoded
User-Agent: NativeHost
Host: api.twitter.com
Connection: Keep-Alive
Cache-Control: no-cache
Pragma: no-cache

status=%23%D1%82%D0%B5%D1%81%D1%82

Twitter converts a string %23%D1%82%D0%B5%D1%81%D1%82 to a string тест correctly