Open GoogleCodeExporter opened 8 years ago
Please consider raising the priority of this.
Original comment by daryl.sp...@gmail.com
on 1 Sep 2010 at 4:02
are you running the very latest code from the repo? I know I tested unicode
recently because I was working on another bug that is unicode related.
but yes, if you are using the default tip I will raise the priority and also
make time tonight to find out why
Original comment by bear42
on 1 Sep 2010 at 4:04
Yes, I believe I am using the very latest code. I don't have a lot of
experience with Mercurial (so I might be doing something wrong), but I just
tried to pull any new changes and got:
$ hg pull
pulling from https://python-twitter.googlecode.com/hg/
searching for changes
no changes found
Original comment by daryl.sp...@gmail.com
on 1 Sep 2010 at 4:11
hrmm, ok
i'll take a look at this tonight when I get home from work.
Original comment by bear42
on 1 Sep 2010 at 4:14
Original comment by bear42
on 1 Sep 2010 at 4:14
Maybe http://www.gossamer-threads.com/lists/python/dev/645002 helps a bit.
A workaround for me was to do
>>> status = api.PostUpdate(text.encode('utf8'))
Original comment by christop...@gmail.com
on 4 Sep 2010 at 10:20
Seeing this in work in progress on getting the tests to run... will use
text.encode for now (in tests)
Original comment by colinthe...@googlemail.com
on 7 Sep 2010 at 5:17
Hello, I have the same problem. Yes, one can use .encode('utf8') and this will
work - unless the string becomes longer than 140 characters by encoding it
(yes, the len() of the text increases by encoding it, if it contains non-ascii
characters).
This means that tweets, altough <140 characters long, cannot be sent with
api.PostUpdate().
I am not sure that this is really python-twitters fault, but would like to hear
how to do this properly.
best regards
/thomas
Original comment by thomas.m...@gmail.com
on 6 Oct 2010 at 1:41
The API allows you to specify an input encoding. By default this is set to None
if you pass nothing in. This will cause python-twitter to process the string
directly without doing any encoding/decoding.
The workaround people have been using of doing
api.PostUpdate(text.encode('utf8')) will cause python-twitter to do
len(text.encode('utf8')) which won't be the actual length of the string due to
how python handles character encoding.
I believe the correct thing to do here is pass a character encoding in when
creating the Api instance and then pass the raw strings in. E.g.
api = Api(..., input_encoding='utf8')
api.PostUpdate('ب')
Will work :)
Original comment by colinthe...@googlemail.com
on 15 Nov 2010 at 10:13
[deleted comment]
Note: you'll still have to call .encode on any utf8 text passed in. Seems that
urllib is expecting ascii... erk.
Original comment by colinthe...@googlemail.com
on 15 Nov 2010 at 12:30
Proposed patch.
Original comment by edward.h...@gmail.com
on 4 Feb 2011 at 4:43
Attachments:
Original issue reported on code.google.com by
daryl.sp...@gmail.com
on 1 Sep 2010 at 3:59