locked
Translator API adding spaces into <br /> tags RRS feed

  • Question

  • I have been playing around with the translation API with reasonable success but have a slightly odd issue where a space is being added into <br /> tags in the returned (translated) text so that rather than the tag being <br /> it is now < br /> (the extra space is after the < and before BR).

    I am pretty sure it is the translator SOAP service doing this rather than my code but am open to suggestions!

    $soapTranslator = new SOAPMicrosoftTranslator($accessToken, $wsdlUrl);
    $responseObj = $soapTranslator->objSoap->Translate($requestArg);
    $vTransNewData = $responseObj->TranslateResult;

    The class code is as per the MSDN library here: http://msdn.microsoft.com/en-us/library/ff512437.aspx.

    I know that I could simply put in a string replacement to replace < br /> with <br />, but that is a bit of a bodge and shouldn't be neccessary.


    Thursday, May 31, 2012 1:55 PM

Answers

  • Ignore me - being dumb. I had the content type set to text/plain when it should have been text/html.
    • Marked as answer by MJCL Thursday, May 31, 2012 2:11 PM
    Thursday, May 31, 2012 2:11 PM