0

I am getting this,

"title": "=?UTF-8?Q?=E2=80=9CUber=E2=80=99s_Complicit_Board=E2=80=9D_published_?= =?UTF-8?Q?in_Monday_Note_by_Jean-Louis_Gass=C3=A9e?=",  //here

I m receiving following josn data,

 {

            "updated_at": "2017-06-27 13:45:23",
            "user_name": "noreply@medium.com",
            "first_name": "",
            "last_name": "",
            "email": "noreply@medium.com",
            "profile_pic": "https://secure.gravatar.com/avatar/1f98a43dd7d8f9568b557c7f03fe854e?s=80&r=g&d=identicon",
            "ticket_number": "AAAA-0000-0001",
            "id": 2,
            "title": "=?UTF-8?Q?=E2=80=9CUber=E2=80=99s_Complicit_Board=E2=80=9D_published_?= =?UTF-8?Q?in_Monday_Note_by_Jean-Louis_Gass=C3=A9e?=",
            "created_at": "2017-06-27 13:45:23",
            "department_name": "Support",
            "priotity_name": "Low",
            "priority_color": "#00a65a",
            "sla_plan_name": "Low",
            "help_topic_name": "Support query",
            "ticket_status_name": "Open",
            "department_id": 1,
            "user_dpt": null,
            "attachment": 0,
            "overdue_date": "2017-06-27 18:45:23"
        },
        {
            "updated_at": "2017-06-27 13:45:19",
            "user_name": "help@teamtreehouse.com",
            "first_name": "Treehouse",
            "last_name": "",
            "email": "help@teamtreehouse.com",
            "profile_pic": "https://secure.gravatar.com/avatar/84541406cf3c552347f8e31cef7d32ce?s=80&r=g&d=identicon",
            "ticket_number": "AAAA-0000-0000",
            "id": 1,
            "title": "=?UTF-8?Q?=C2=A0New_skills", // here also
            "created_at": "2017-06-27 13:45:19",
            "department_name": "Support",
            "priotity_name": "Low",
            "priority_color": "#00a65a",
            "sla_plan_name": "Low",
            "help_topic_name": "Support query",
            "ticket_status_name": "Open",
            "department_id": 1,
            "user_dpt": null,
            "attachment": 0,
            "overdue_date": "2017-06-27 18:45:19"
        }
    ]
}
Piyush
  • 1,534
  • 12
  • 32
  • Please check following link to decode data in UTF 8 format https://stackoverflow.com/questions/4913499/utf8-character-decoding-in-objective-c https://stackoverflow.com/questions/32772037/convert-utf8-strings-in-json-to-plain-text-ios – Rajeev Singh Jun 30 '17 at 05:59

2 Answers2

0

You need to decode the title string, so check the below code.

NSString *encodedString =@"?UTF-8?Q?=C2=A0New_skills";
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString: encodedString options:0];
NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
NSLog(@"%@", decodedString);

        NSLog(@"Decoded String: %@",decodedString);
Vignesh Davins
  • 285
  • 1
  • 13
0

That is the "encoded-word" encoding from RFC 2047.

There is an online decoder here: http://dogmamix.com/MimeHeadersDecoder/

libetpan can decode it (see mailmime_encoded_word_parse in https://github.com/dinhviethoa/libetpan/blob/master/src/low-level/mime/mailmime_decode.c). That is pretty heavyweight if you only care about this field. You could write a decoder yourself based on the RFC instead.

Community
  • 1
  • 1
Ewan Mellor
  • 6,747
  • 1
  • 24
  • 39