0

I am getting following value from server :

        message = "\Ud835\Udc2d\Ud835\Udc1e\Ud835\Udc2c\Ud835\Udc2d";

When i show to label it show ????

I am using following code to show :

    NSAttributedString *attribute = [[NSAttributedString alloc] initWithData:[self.message dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: [NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:nil error:nil];
lbl.attributedText = attribute;
user3772344
  • 153
  • 2
  • 10
  • Try this https://stackoverflow.com/questions/31272561/working-with-unicode-code-points-in-swift – Vinaykrishnan Mar 29 '18 at 11:15
  • 1
    Possible duplicate of [Display HTML text in UILabel iphone](https://stackoverflow.com/questions/15872257/display-html-text-in-uilabel-iphone) – koen Mar 29 '18 at 12:36

1 Answers1

0

The problem is that they are not valid UTF-8 characters. The encoding is probably something other than UTF-8.

Unicode character d835
Unicode character dc2d
Unicode character dc1e
:

LGP
  • 4,135
  • 1
  • 22
  • 34