Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

When pasted a single quote in WordPress, it shows , which in source code it shows ’ and in iOS's UIWebView, it shows ’. (Similar for ‘ which shows ‘ )

How to make iOS's UIWebView showing correct punctuation ?

Here is the code block I use:

NSURL *bio_url = [NSURL URLWithString:@"XML_URL_HERE"];
    NSURLRequest *request = [NSURLRequest requestWithURL:bio_url];
    AFHTTPClient *client = [[AFHTTPClient alloc] init];
    AFHTTPRequestOperation *operation = [client HTTPRequestOperationWithRequest:request
                                                                        success:^(AFHTTPRequestOperation *operation, id responseObject) {
                                                                            NSError *error = nil;


                                                                            GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:operation.responseData options:0 error:&error];
                                                                            NSString *xpath = @"/response/content";
                                                                            NSArray *nodes = [doc nodesForXPath:xpath error:&error];
                                                                            NSString *content = [[nodes objectAtIndex:0] stringValue];

                                                                            NSString *fullHTML = [NSString stringWithFormat:@"<!DOCTYPE html>\
                                                                            <html>\
                                                                            <head>\
                                                                            <meta charset='utf-8'>\
                                                                            <style type='text/css'>body { font-family: Arial; font-size: 9px; }</style>\
                                                                            </head>\
                                                                            <body>%@</body></html>", content];

                                                                            [web_view loadHTMLString:fullHTML
                                                                                             baseURL:nil];
                                                                            if (error) {
                                                                                NSLog(@"Error creating XML: %@", error);
                                                                            }
                                                                        }
                                                                        failure:^(AFHTTPRequestOperation* operation, NSError *error) {

    }];
    [operation start];

Note that I even construct a new HTML by myself in above code.

Here is the XML content :

<response>
<request>fetch_wp_page</request>
<content><![CDATA[<p>Content is not important. &acirc;&#128;&#152; Right &acirc;&#128;&#153;?</p>]]></content>
</response>
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.