So I rewrote TTYtter to count in characters instead of bytes, because users
have been asking for ages for full 140-character tweets, and I was under
the impression that the API now supported them thanks to Raffi's confirmation.
Unfortunately, there seems to be a bug as soon as the tweet gets over 140
bytes (user credentials removed). The Japanese was picked to be exactly 10
characters long (the "yo" hiragana lands on the 10th character). The return
block is the response from the server, which is only edited for length. I
attached the transcript. Notice that as soon as it gets overlength, it bombs.

-- 
------------------------------------ personal: http://www.cameronkaiser.com/ --
  Cameron Kaiser * Floodgap Systems * www.floodgap.com * ckai...@floodgap.com
-- Shady business do not make for sunny life. -- Charlie Chan -----------------
TTYtter> ひらがなテストんだよ
-- waiting 3 seconds to tweet, ^C cancels: "ひらがなテストんだよ"
-- sending to server
/usr/bin/curl -K -
-s 
-m 13
-u ttyttertest:XXX
url = "https://api.twitter.com/1/statuses/update.json";
data = 
"source=TTYtter&status=%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88"


-- return --
{"place":null, [...] 
"truncated":false,"text":"\u3072\u3089\u304c\u306a\u30c6\u30b9\u30c8\u3093\u3060\u3088"}

TTYtter> ひらがなテストんだよひらがなテストんだよ
-- waiting 3 seconds to tweet, ^C cancels: "ひらがなテストんだよひらがなテストんだよ"
-- sending to server
/usr/bin/curl -K -
-s 
-m 13
-u ttyttertest:XXX
url = "https://api.twitter.com/1/statuses/update.json";
data = 
"source=TTYtter&status=%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88"
-- return --
{"in_reply_to_user_id":null, 
[...]"text":"\u3072\u3089\u304c\u306a\u30c6\u30b9\u30c8\u3093\u3060\u3088\u3072\u3089\u304c\u306a\u30c6\u30b9\u30c8\u3093\u3060\u3088"}

TTYtter> ひらがなテストんだよひらがなテストんだよひらがなテストんだよひらがなテストんだよ
-- waiting 3 seconds to tweet, ^C cancels: 
"ひらがなテストんだよひらがなテストんだよひらがなテストんだよひらがなテストんだよ"
-- sending to server
/usr/bin/curl -K -
-s 
-m 13
-u ttyttertest:XXX
url = "https://api.twitter.com/1/statuses/update.json";
data = 
"source=TTYtter&status=%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88"
-- return --
{"in_reply_to_user_id":null, [...] 
"text":"\u3072\u3089\u304c\u306a\u30c6\u30b9\u30c8\u3093\u3060\u3088\u3072\u3089\u304c\u306a\u30c6\u30b9\u30c8\u3093\u3060\u3088\u3072\u3089\u304c\u306a\u30c6\u30b9\u30c8\u3093\u3060\u3088\u3072\u3089\u304c\u306a\u30c6\u30b9\u30c8\u3093\u3060\u3088"}


And now the bug,

TTYtter> ひらがなテストんだよひらがなテストんだよひらがなテストんだよひらがなテストんだよひらがなテストんだよ
-- waiting 3 seconds to tweet, ^C cancels: 
"ひらがなテストんだよひらがなテストんだよひらがなテストんだよひらがなテストんだよひらがなテストんだよ"
-- sending to server
/usr/bin/curl -K -
-s 
-m 13
-u ttyttertest:XXX
url = "https://api.twitter.com/1/statuses/update.json";
data = 
"source=TTYtter&status=%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83%88%e3%82%93%e3%81%a0%e3%82%88%e3%81%b2%e3%82%89%e3%81%8c%e3%81%aa%e3%83%86%e3%82%b9%e3%83"


-- return --
Invalid Unicode value in one or more parameters

I can't see anything wrong with the UTF-8 unless my eyes are bleeding.

-- 
------------------------------------ personal: http://www.cameronkaiser.com/ --
  Cameron Kaiser * Floodgap Systems * www.floodgap.com * ckai...@floodgap.com
-- Shady business do not make for sunny life. -- Charlie Chan -----------------

Reply via email to