ios - Bullet points are not recognized in HTML String -
i have string:
nsstring *str1 = @"\u2022 held in custody longer period of time may have been necessary."; i converting html string using code :
- (nsstring *)htmlstring { nsdictionary * const exportparams = @{nsdocumenttypedocumentattribute: nshtmltextdocumenttype}; nsattributedstring *attributed = [[nsattributedstring alloc] initwithstring:str1]; nsdata *htmldata = [attributed datafromrange:nsmakerange(0, attributed.length) documentattributes:exportparams error:nil]; return [[nsstring alloc] initwithdata:htmldata encoding:nsutf8stringencoding]; } but bullet points not showing in html string. it's showing ? instead of bullet point. please tell me solution.
please try below code -
- (nsstring *)htmlstring { nsdictionary * const exportparams = @{nsdocumenttypedocumentattribute: nshtmltextdocumenttype}; letterstring = [letterstring stringbyreplacingoccurrencesofstring:@"\u2022" withstring:@"•"]; nsattributedstring *attributed = [[nsattributedstring alloc] initwithstring:letterstring]; nsdata *htmldata = [attributed datafromrange:nsmakerange(0, attributed.length) documentattributes:exportparams error:nil]; return [[nsstring alloc] initwithdata:htmldata encoding:nsutf8stringencoding]; }
Comments
Post a Comment