1

I have to decode a HTML string, but the response is not coming well. This is my URL from where I have to decode my HTML string: http://www.delvetech.org/sharpkirana/sharpapi/aboutApi.php.

My code is given below:

NSString *HTML = [NSString stringWithFormat:@"<html>\n"
                  "<head>\n"
                  "<style type=\"text/css\">\n"
                  "body {font-family: \"%@\"; font-size: %@; color:#%@;}\n"
                  "</style>\n"
                  "</head>\n"
                  "<body>%@</body>\n"
                  "</html>",
                  font.familyName, @(font.pointSize), colorHexString, htmlBodyString];
return HTML;

Is there a problem in my code or are the HTML strings wrong?

dakab
  • 5,379
  • 9
  • 43
  • 67
arun
  • 57
  • 6
  • Helpful link : http://stackoverflow.com/questions/8088473/how-do-i-url-encode-a-string – Furtiro Jun 06 '16 at 07:36
  • What's the method that you use to parse the api's response? Which means how to get the **htmlBodyString**? – EricXuan Jun 06 '16 at 09:02
  • @EricXuan sir this is my method-NSString *url = [NSString stringWithFormat:@"http://www.delvetech.org/sharpkirana/sharpapi/termNconditionApi.php?description=%@",[self.textUrl stringByReplacingOccurrencesOfString:@" " withString:@"+"]]; [DownloadManager getData:url withBlock:^(NSData *receivedData, NSURLResponse *responce, NSError *error) – arun Jun 06 '16 at 09:23

1 Answers1

0
NSAttributedString *HTML=[[NSAttributedString alloc] initWithData:[HTMLCodeString dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: [NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:nil error:nil];

retutn HTML;
  • sir this code not solved my problem...actually i"m new in iOS so plz tell me something in detail...plz sir – arun Jun 09 '16 at 09:19