I am using a url request to receive data from MySQL. The data is received in a JSON format. This data also includes unicode characters (for example greek letters).
Then, in Swift, I am using JSONSerialization like this:
if let json = try JSONSerialization.jsonObject(with: data!, options: []) as? [String: Any] {
The keys of json are number indices. Then I take a nested dictionary like this:
let dictionary = json[key] as? [String: Any]
Then I assign:
var content = dictionary!["content"] as! String
This content has unicode characters inside it.
Unicode characters appear like this (if I print dictionary): \U03b1 (for the greek letter Alpha).
The problem is that Swift cannot read those characters because Swift expects unicode characters to be like this: \u{03b1}.
The value of content is an empty string: ""
How can I solve this? Either have PHP send those characters in the way the Swift "understands" them, or having Swift decoding the incoming data in the proper way.
Any ideas?
Thanks!