gfcapalbo / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

PostUpdate does not support unicode #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. tweet = u'Tweet \u2019'
2. api.PostUpdate(twitter_username, twitter_password, tweet)
3. UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in
position 7: ordinal not in range(128)

What version of the product are you using? On what operating system?
SVN rev 47, Python 2.4.4, Linux 2.6.18

Please provide any additional information below.
Replacing the post_data line in PostUpdate with the following solves the
issue (for me at least)

post_data = urllib.urlencode({'status': text.encode('ascii',
'xmlcharrefreplace')})

Original issue reported on code.google.com by Robin.Fr...@gmail.com on 12 May 2007 at 1:36

GoogleCodeExporter commented 9 years ago
I can reproduce.  Accepting.

Original comment by dclinton on 22 May 2007 at 5:58

GoogleCodeExporter commented 9 years ago
This should be fixed in 0.4.

Original comment by dclinton on 13 Jun 2007 at 8:08

GoogleCodeExporter commented 9 years ago
I have tested and can confirm it is working.

Thanks!

Original comment by Robin.Fr...@gmail.com on 13 Jun 2007 at 11:44

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
tweet.py needs to be updated to decode the message argument as Unicode.
api.PostUpdate(message) should be changed to 
api.PostUpdate(message.decode("utf-8"))

Original comment by m.mckin...@gmail.com on 4 Mar 2009 at 1:29

Attachments:

GoogleCodeExporter commented 9 years ago
Since this is actually a different issue (how we handle character encodings in
tweet.py) can you open a new ticket and we'll track the solution there, please?

Original comment by dclinton on 4 Mar 2009 at 2:35