buckk / python-twitter

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

PostUpdate status message length check fails if the message is multi-byte charactor #147

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

api = twitter.Api(username="user", password="passwd", input_encoding="utf-8")
api.PostUpdate("あ" * 140)

then we got TwitterError.

Original issue reported on code.google.com by liris...@gmail.com on 16 Jul 2010 at 8:27

Attachments:

GoogleCodeExporter commented 8 years ago
Japanese 1 utf-8  charator consumes  3 bytes. So len(status) returns 420 in the 
above case and we get "Text must be less than or equal to %d character".

We must count the string length as  unicode. The patch count the string lengh 
as unicode.

Original comment by liris...@gmail.com on 18 Jul 2010 at 2:44

GoogleCodeExporter commented 8 years ago
patch applied (with small tweak) to revision 3303282d1f

Original comment by bear42 on 18 Aug 2010 at 9:02