I am running into URL encoding issue while connecting to Microsoft translation api from the objective c code.
The <Enter> (\n) are not getting encoded properly. Below is my code:
This is how I encode the string in IOS code before hitting http://api.microsofttranslator.com
NSString *urlEncodedString = [mytext stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
The response from the bing translation is encoded back as
NSString *response_txt = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding] ;
The challenge that I am facing is, if there are enters in myText, the the translated text shows it as \u000a. For e.g.
If the input is:
This is line 1.
<enter>
This is line 2.
The Translated Text is
This is line 1.\u000aThis is line 2.
Please advise. Thanks in advance.
'\u000a'is the code fornewline? Where is is shown that way? UsingNSLog()? – Amin Negm-Awad 17 mins ago