When I use the defaults command I see that special characters are encoded into ASCII by replaceing non-ASCII charagers with \\U and the numeric code for the unicode character in the output like "\\U00e4r"
Is there an API in Foundation or Cocoa that lets me encode and decode my own strings in way?
I need to have a string with a content like like "\\U00e4r" and decode it into another string to "är". Similarily I need to be able to convert a string with content "är" into another string with content "\\U00e4r". Naturally I can write functions to do this manually, by looping over every character in the string, but I guess such encoding/decoding functions must already exist in the apple APIs ready for use.
(I have not been able to find functions for such encoding/decoding when searcing the documentation and web. Probably because I have phrased the search incorreclty.)
I am programming in Swift on OS X 10.11.2. What is the easiest way to do these conversions of strings?
Thank you in advance for your help!