Looking at the example request uri you've shared, I suspect that you're running into the problem because the string you're sending is not valid html. So the translation engine doesn't recognize it as html. So it tries to translate it and, of course, fails. The real question here is why you are breaking your requests into chunks of only 180 characters when the API will accept requests well in excess of 1,000 characters via the GET interface, and up to 5,000 characters via POST. In fact, the API grows increasingly accurate with longer strings because of the way machine translation works. At any rate, it would be advisable to make sure that you're splitting your strings not on strict character counts, but on complete sentences and/or clauses. And there is no real reason to submit strings that are entirely html at all.
Hope this helps. Jeremy R. Geerdes Effective website design & development Des Moines, IA For more information or a project quote: http://jgeerdes.home.mchsi.com http://jgeerdes.blogspot.com http://jgeerdes.wordpress.com [email protected] Unless otherwise noted, any price quotes contained within this communication are given in US dollars. If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church! And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com ! On Dec 9, 2009, at 12:17 AM, J wrote: > my site provides an automatic translation feature,based on google ajax > api service. > > i found a bug when got request like : > > http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=%3E%3CIMG%20src=%22http://www.jkc360.com/Upload/20090912131847991&langpair=zh-CN > > |en > > or > > http://ajax.googleapis.com/ajax/services/language/translate? > v=1.0&q=><IMG > src="http://www.jkc360.com/Upload/20090912131847991&langpair=zh-CN|en > > > google gives result: > {"responseData": {"translatedText":"\u003chtml\u003e \u0026quot;"}, > "responseDetails": null, "responseStatus": 200} > > > see,it's a bug. > my program automatically split the text and submit sections(no more > than 180 characters ) to google translation service.when the section > includes html code,my program got wrong translate result. > > -- > > You received this message because you are subscribed to the Google > Groups "Google AJAX APIs" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected] > . > For more options, visit this group at > http://groups.google.com/group/google-ajax-search-api?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
