Re: [twitter-dev] Re: illegal character in json feed

2011-06-15 Thread michael hazzard
Much better!

I let http://jsfiddle.net/NBCGf/34/ run 1000 tries successfully before
taking mercy on your servers and shutting it off.

Good job and thanks,

//mh


On Tue, Jun 14, 2011 at 11:28 PM, themattharris
wrote:

> Hey everyone,
>
> Thanks for all the information you provided. We were able to reproduce
> the problem and the engineers have now released a fix.
> You shouldn't receive any garbled API responses anymore, if you do
> please let us know.
>
> Best,
> @themattharris
>
> On Jun 14, 7:59 pm, michael hazzard  wrote:
> > Marc,
> > Nice theory but I'm not so sure since I'm reloading the same exact tweet
> (I
> > think)over and over again and its getting corrupted.
> > Although I've heard of type of thing before where an application
> (notepad)
> > tries to do charset encoding detection but fails and outputs a corrupted
> > file upon reopening.
> > On Jun 14, 2011 9:24 PM, "marc fawzi"  wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > Re: error handling the jsonp "script error"
> >
> > > I started using the previously mentioned "window.onerror" mechanism
> > > wherein I reload the iframe from which I'm initiating the jsonp call,
> > > up to 10 times, 3 seconds apart (the average delay in getting the
> > > script back from twitter, which triggers the error which in turn
> > > starts another jsonp request and so on, up to 10 times)
> >
> > > I'm using this approach in addition to my pre-existing "5 retries on
> > > general error, 10 seconds apart" non-blocking error handler which was
> > > able to survive the "illegal character" error on its own and recover
> > > from it, but sometimes it ended up with "Sorry, try again
> > > later" (twitter recovers after a while on its own and my app continues
> > > from there but sometimes the error persists with twitter.) The pre-
> > > existing handler was using more time on average (about 20-50 seconds)
> > > and the newly added window.onerror mechanism, which runs before the
> > > self-terminating, non-blocking handler loop, is taking less time on
> > > average (6-15 seconds) to go thru the same process for the jsonp
> > > "script error" reported by the browser. However, sometimes, this error
> > > persists for too many retries and falls out of the window.onerror but
> > > 99% of the time so far it's getting caught by my pre-existing general
> > > error handler (now, the second layer of defense)
> >
> > > I never thought I had to double up! :)
> >
> > > Re: illegal character
> >
> > > Wow. Really? you can have the unicode character for "delete" \u0008 in
> > > the response? I have a full dump of the jsonp response in firebug and
> > > that's the character that firebug terminates at when reporting the
> > > error so I assume that's the culprit, but could be others as well. On
> > > a more relevant note, I don't think the illegal character coming back
> > > in jsonp have anything to do with the tweet's content. It looks as if
> > > some tweets contain some combination of characters that cause twitter
> > > to return a binary dump of some sort (in casual terms, it causes it to
> > > hallucinate.)
> >
> > > Anyway intriguing. :)
> >
> > > Marc
> > > On Jun 14, 6:53 pm, Romica  wrote:
> > > > I have the same problem (bad JSON most of the times). The weird thing
> > > > is that if I access the URL direct from the browser it works (good
> > > > JSON every time). I'm using jQuery.getJSON and I think that this (or
> > > > something connected to this) might be the problem.
> >
> > > > Unfortunately I cannot use window.onerror (as Michael suggested)
> > > > because I have multiple asynchronous requests at the same time (it
> > > > would be tricky and expensive to find out which one is bad - at least
> > > > I suppose so).
> >
> > > > Good luck in solving this
> >
> > > --
> > > Twitter developer documentation and resources:
> https://dev.twitter.com/doc
> > > API updates via Twitter:https://twitter.com/twitterapi
> > > Issues/Enhancements Tracker:
> >
> > https://code.google.com/p/twitter-api/issues/list> Change your
> membership to this group:
> >
> > https://groups.google.com/forum/#!forum/twitter-development-talk
>
> --
> Twitter developer documentation and resources: https://dev.twitter.com/doc
> API updates via Twitter: https://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> https://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> https://groups.google.com/forum/#!forum/twitter-development-talk
>



-- 
Thank You,

Michael Hazzard
(954) 247-4461 

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: illegal character in json feed

2011-06-14 Thread michael hazzard
Marc,
Nice theory but I'm not so sure since I'm reloading the same exact tweet (I
think)over and over again and its getting corrupted.
Although I've heard of type of thing before where an application (notepad)
tries to do charset encoding detection but fails and outputs a corrupted
file upon reopening.
On Jun 14, 2011 9:24 PM, "marc fawzi"  wrote:
>
> Re: error handling the jsonp "script error"
>
> I started using the previously mentioned "window.onerror" mechanism
> wherein I reload the iframe from which I'm initiating the jsonp call,
> up to 10 times, 3 seconds apart (the average delay in getting the
> script back from twitter, which triggers the error which in turn
> starts another jsonp request and so on, up to 10 times)
>
> I'm using this approach in addition to my pre-existing "5 retries on
> general error, 10 seconds apart" non-blocking error handler which was
> able to survive the "illegal character" error on its own and recover
> from it, but sometimes it ended up with "Sorry, try again
> later" (twitter recovers after a while on its own and my app continues
> from there but sometimes the error persists with twitter.) The pre-
> existing handler was using more time on average (about 20-50 seconds)
> and the newly added window.onerror mechanism, which runs before the
> self-terminating, non-blocking handler loop, is taking less time on
> average (6-15 seconds) to go thru the same process for the jsonp
> "script error" reported by the browser. However, sometimes, this error
> persists for too many retries and falls out of the window.onerror but
> 99% of the time so far it's getting caught by my pre-existing general
> error handler (now, the second layer of defense)
>
> I never thought I had to double up! :)
>
> Re: illegal character
>
> Wow. Really? you can have the unicode character for "delete" \u0008 in
> the response? I have a full dump of the jsonp response in firebug and
> that's the character that firebug terminates at when reporting the
> error so I assume that's the culprit, but could be others as well. On
> a more relevant note, I don't think the illegal character coming back
> in jsonp have anything to do with the tweet's content. It looks as if
> some tweets contain some combination of characters that cause twitter
> to return a binary dump of some sort (in casual terms, it causes it to
> hallucinate.)
>
> Anyway intriguing. :)
>
> Marc
> On Jun 14, 6:53 pm, Romica  wrote:
> > I have the same problem (bad JSON most of the times). The weird thing
> > is that if I access the URL direct from the browser it works (good
> > JSON every time). I'm using jQuery.getJSON and I think that this (or
> > something connected to this) might be the problem.
> >
> > Unfortunately I cannot use window.onerror (as Michael suggested)
> > because I have multiple asynchronous requests at the same time (it
> > would be tricky and expensive to find out which one is bad - at least
> > I suppose so).
> >
> > Good luck in solving this
>
> --
> Twitter developer documentation and resources: https://dev.twitter.com/doc
> API updates via Twitter: https://twitter.com/twitterapi
> Issues/Enhancements Tracker:
https://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: illegal character in json feed

2011-06-14 Thread michael hazzard
Fyi Guys,

The way I worked around this since a try-catch was useless is that I used a
window.oneerror = function(){ to ignore the offending tweet and count errors
etc.

//mh

On Tue, Jun 14, 2011 at 6:17 PM, Paul Bailey wrote:

> We are seeing the same problem on our latest site:
> http://grb.culturemap.com/senior-games/
>
> It is intermittent; sometimes good JSON is returned and sometimes not.
>
>  --
> Twitter developer documentation and resources: https://dev.twitter.com/doc
> API updates via Twitter: https://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> https://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> https://groups.google.com/forum/#!forum/twitter-development-talk
>



-- 
Thank You,

Michael Hazzard
(954) 247-4461 

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: illegal character in json feed

2011-06-14 Thread Paul Bailey
We are seeing the same problem on our latest 
site: http://grb.culturemap.com/senior-games/

It is intermittent; sometimes good JSON is returned and sometimes not.

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: illegal character in json feed

2011-06-14 Thread Taylor Singletary
Thanks for all the extra info, folks -- this is very useful and I've now got
a reproducible case. We'll look into this.

Thanks!
@episod  - Taylor
Singletary


On Tue, Jun 14, 2011 at 2:20 PM, Matt  wrote:

> Can confirm this is happening to me too, for this request:
>
>
> http://search.twitter.com/search.json?&q=from%3Atfr%20OR%20from%3ASOIANYC&rpp=5&callback=jQuery16106527990615355083_1308086280457&_=1308086281400
>
> (I'm fetching tweets from two users - "tfr" and "SOIANYC" - if I
> remove SOIANYC from the query, it returns properly-formatted data.
> maybe this helps?)
>
> On Jun 14, 9:51 pm, Mike McNeil  wrote:
> > Same thing's happening to me.  Check out:
> >
> http://search.twitter.com/search.json?q=%23jimromeisburning&callback=dog<
> http://search.twitter.com/search.json?q=%23jimromeisburning&callback=dog>
> >
> > Should look like this:
> > dog(
> > {
> >
> >- -
> >results: [
> >   - -
> >   {
> >  - from_user_id_str: "257702817"
> >  - profile_image_url: "
> >
> http://a1.twimg.com/profile_images/1364757456/2011-05-22_13.20.33_nor...
> >  "
> >  - created_at: "Tue, 14 Jun 2011 20:36:33 +"
> >  - from_user: "ATLienSince1987"
> >  - id_str: "80735397449183232"
> >  - -
> >  metadata: {
> > - result_type: "recent"
> >  }
> >  - to_user_id: null
> >  - text: "#JimRomeIsBurning"
> >  - id: 80735397449183230
> >  - from_user_id: 257702817
> >  - geo: null
> >  - iso_language_code: "is"
> >  - to_user_id_str: null
> >  - source: " >  rel="nofollow">Plume  "
> >   } ..
> >]
> >- max_id: 80735397449183230
> >- since_id: 0
> >- refresh_url: "?since_id=80735397449183232&q=%23jimromeisburning"
> >- results_per_page: 15
> >- page: 1
> >- completed_in: 0.185672
> >- since_id_str: "0"
> >- max_id_str: "80735397449183232"
> >- query: "%23jimromeisburning"
> >
> > }
> >
> > )
> >
> > But 3/5 times it doesn't, it looks like this:
> >
> > dog(  ݘYo F ǿʚF݇Z <   & 85b )  M č ] 7 w .ےl ҇ A o 3 oN% hj 7 _ 2nkY * r
>  A iH U
> >   2 ȸ
> > hϛf X 75 w _ @ \ ńt P   R 2 kS I ~
> > ` I# 8i` ^+   Ȏ .󻌡_0| ` } { P: $
> > M 8` E  e  K $Y $N qs= л ԍ i NW E ȯֲ SU~4 < _ Vz0Y ,txǧNw Cg |VU
> H ~MMf P sۀ N k V sP4 W Kk g h J n L   i+ d1 M O   g E[ʿZ < { m W g q ]؈ 9
>   ֏A ] v9_ ͔wi CF0 a qHE +
> > Ǧ P# Um! = Y ` T  K+ 1 c< 2  = t v߆   A $ }   * ! .܇   2  G 4, 5 DcS
> > s3FF bɄU*f> H O 4 Dd X & <5ʍ [0қN B |2h#.D 7 A@s#OĘ >@љ @ g Z
> "py\ Iw)bA q(" ; S$E   F/e= "O % d G@*A m Թ K J~B'? hTɦ Fu[I (;c ; Gpʇ E
> > dQ IH / . p E$ < & Q L < * Gb{4 Y S . /$ ۪   υ P f 8 OP- > Z͏ `ky ' D
> Lt D I A~ 'M [ Od E'5 #:sڥj > Dz9.Z / ]Q Y ~ x d3+ f{ , JIP M = % h$ 圜 m >%|
> _M   Q #, * Osj V\ 7B C` p  r  odҡ M n Z1N   p(v) |p (
> > Xd fȵP ! @ A p E hW d< *iP fPY%5J   ٯ џ R ܶj eW P  'ۡ a
> >   c 3 b kc p v i O z B u K r .r Do[ uq zf ؤ oSu T M  ۥ${ R u1 > E H 5
> -(= 7 ZA   ei8* Tvd TY L yf t = Z w1 H @ p *v ~Ru N ܶ C5
> !jJmVC \ s ptk [ w ^2 ){. q } j wI
> > K XնY 3m Am,/o 7x8 & p `  @># ż ʸ / l v # vi -  `2娐 ' aE Ɗ % / m !
> > D x );
> >
> > Stackoverflow question:
> http://stackoverflow.com/questions/6348065/sencha-touch-jsonp-error
>
> --
> Twitter developer documentation and resources: https://dev.twitter.com/doc
> API updates via Twitter: https://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> https://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> https://groups.google.com/forum/#!forum/twitter-development-talk
>

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk