I am retrieving quotes from an online API in JSON format. However, the some of the characters are like appearing strange when i used UTF8 character encoding with okhttputils download2 option. any help?
SAMPLE
"quote": "If you can\u00e2\u20ac\u2122t resolve your problems in peace, you can\u00e2\u20ac\u2122t solve war. ",
The output is correct. The JSON was not encoded properly. They treated Windows-1252 data as UTF8 data.
You can "fix" the encoding error with:
B4X:
Dim s As String = $"{"quote":
"If you can\u00e2\u20ac\u2122t resolve your problems in peace, you can\u00e2\u20ac\u2122t solve war. "}"$
Dim jp As JSONParser
jp.Initialize(s)
Dim m As Map = jp.NextObject
Dim value As String = m.Get("quote")
Dim b() As Byte = value.GetBytes("windows-1252")
value = BytesToString(b, 0, b.Length, "utf8")
Log(value)