I'm trying to convert decode to dictionary from the below url encoded string. The normal method of doing so is given below. In my case it is not working. Also i need to remove any character like \u{05}
let params = str.components(separatedBy: "&").map({
$0.components(separatedBy: "=")
}).reduce(into: [String:String]()) { dict, pair in
if pair.count == 2 {
dict[pair[0]] = pair[1]
}
}
My url encoded string is
"id=sfghsgh=sbfsfhj&name=awsjdk_fs\u{05}"
I'm expecting result as
{
"id" = "sfghsgh=sbfsfhj",
"name" = "awsjdk_fs"
}
How it is possible to achive?