Preserve line feed/Carriage return from original content during Bing translation RRS feed

  • Question

  • Dear support,

    During testing, I found that line feed (\n) and carriage return(\r) can't be preserved after translation. \r\n works, which makes sense to me, too. Although it might sound stupid but newline (this case has to bee CRLF) is my delimiter to concatenate hundreds of entries, and split text to boost performance, and my balance is consumed quickly by the additional character... I found paying for such characters not worth it, but can't sacrifice performance either.

    Just curious if there's better solution for this? This is just my personal inquiry, and there's no problem about Translator API at all. :) Thanks very much ahead.

    Best Regards,

    Friday, October 10, 2014 1:18 AM

All replies

  • Hi Lynn,

    that's right, CR or LF alone are treated as non-sentence breaking white space. A CRLF used with contentType=text/plain mode counts as a new sentence. You do want to maintain the semantics of each phrase or sentence enclosed by CRLF in order to keep translating the unit intact.

    CRLF is a very compact sentence break. If each line already ends with a period or other sentence end punctuation, you could also use ". " (period+space) as a sentence break mark. That would save one character.

    Chris Wendt
    Microsoft Translator

    Friday, October 10, 2014 3:04 AM
  • Hi Chris

    I have the same use case as Lynn.

    Using "\r\n" doesn't work for me. Using "\\" or "\\r" or "\\n" works, though.

    I'm using contentType=text/plain.

    Is the sequence break for each translation unit still the same? If so, why it may not be working for me?


    Friday, October 10, 2014 10:23 PM
  • In HTML mode you need to use <p></p>.

    Friday, October 10, 2014 10:26 PM