atom feed3 messages in how to preserve newlines?
FromSent OnAttachments
egasimusSep 9, 2010 1:17 am 
Jeremy GeerdesSep 9, 2010 4:30 am 
egasimusSep 17, 2010 12:11 am 
Subject:Re: how to preserve newlines?
From:Jeremy Geerdes (
Date:Sep 9, 2010 4:30:04 am

The failure to preserve newlines is a result of the API assuming it's dealing
with HTML, which does not require newlines. If you want to preserve them, you
can specify format=text, but that will result in the API attempting to translate
any HTML markup that you have in the string. Alternatively, you could replace
any newlines with some HTML tag that you will then replace with newlines after
the translation is returned.

Jeremy R. Geerdes Effective website design & development Des Moines, IA

For more information or a project quote:

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Sep 9, 2010, at 3:17 AM, egasimus wrote:

Hi everyone. As a part of some automation stuff I'm working on in order to make my life easier, I'm trying to translate a block of text using, well, a lot of stuff. AutoIt3, Firefox, MozRepl, JavaScript, and, ultimately, Google Translate API. What it all boils down to is a page containing a single textarea and button, which POSTs my source text to, for example,

So the button gets clicked, the text get sent, and the browser goes to that URL and shows the text representation of a responseData object. This text gets read through JS, stripped, and made use of. However, in the translatedText field, all the newlines from the source text are gone without a trace, and this bothers me greatly, as I'd rather keep them. Any ideas how to preserve newlines when using the API?