I'm using the HTTP api.
I have a string to translate that has single quotes in it. when the translated text is returned:
- sometimes the single quotes are changed to escaped double quotes (with a backslash before each).
- sometimes the single quotes are removed.
- sometimes the text inside the single quotes is not translated.
- when there's a single letter inside the single quotes (e.g. 'S') one quote and the letter is removed and the 2nd quote remains.
I want the single quotes left alone (especially since this string will be used in javascript). can i escape them before passing.
examples and code are below. thanks for helping.
some examples:
original: Look at the 'Big Bird' in the sky
translated: "Mire el Big Bird en el cielo."
original: "Look at the 'Big Bird' in the 'S' sky."
translated: "Mirar el 'Big Bird' el ' cielo."
here's my code. langCode happens to be "ES" but i've seen this with other languages, too.
varserviceRootUri=newUri("https://api.datamarket.azure.com/Bing/MicrosoftTranslator/");
TranslatorContainertc=new TranslatorContainer(serviceRootUri);
tc.Credentials=newNetworkCredential(accountKey,accountKey);
vartranslationQuery=tc.Translate (original,langCode, "EN");
vartranslationResults=translationQuery.Execute ().ToList ();
string translated =translationResults.First ().Text;