My app fetches data from TikTok through a API. The username and caption of some TikToks contains some special characters and fonts like: 𝒦ℋ𝒜ℒℰ𝒟 and some contains text in other languages. When I tested the API on its website it show the data correct:
but when I get that data through my app it changes the special characters and language to something like this
Ðе ÑоÑела игÑаÑÑ Ñ Ð±Ð°ÑниÑÑом ÐÐµÐ»Ð¸ÐºÐ¾Ð»ÐµÐ¿Ð½Ð°Ñ ÑкÑипаÑка!
and other values or links that is in English does not change.
The code am using is:
Map<String, String> headers = {
"X-RapidAPI-Host":
"tiktok-downloader-download-tiktok-videos-without-watermark.p.rapidapi.com",
"X-RapidAPI-Key": "-------------------------------",
};
final body = {'url': url};
final uri = Uri.https(
"tiktok-downloader-download-tiktok-videos-without-watermark.p.rapidapi.com",
'/vid/index',
body);
final response = await http.get(
uri,
headers: headers,
);
if (response.statusCode == 200) {
var data = jsonDecode(response.body);
print(data['description'][0]);
}
The API am using
https://rapidapi.com/maatootz/api/tiktok-downloader-download-tiktok-videos-without-watermark
Works bad with cyrillic letters
Try this
json.decode(utf8.decode(response.bodyBytes))