0

I am getting a bunch of data from an API call which returns an array of items, each item has an array of content elements where each content has a string element and an optional image element.

This works most of the times. But if the string has unicode characters being returned from the server, when I try to save them to CoreData, it results in a CoreData fault.

For instance, one of the content elements' string returns \U2666\U2666\U2666 from the server. When I set this in contentElement.text, and do an moc.save(), it results in a data fault.

I am able to save strings with swift unicode format \u{xxxx} to CoreData, but not these "web-based" unicode chars. Is there any way to convert the unicode chars to swift format without using regex?

user3539959
  • 383
  • 3
  • 15

0 Answers0