Reputation: 2902
I am doing an http request with Flutter. The response body text for foreign language is broken.
Here is the result for flutter:
Of which it should be something like this:
The language in question is Korean. Here is my http request code:
fetchJobs() async {
var response = await http.get(Global.apiurl + 'jobs/');
if (response != null && response.statusCode == 200) {
print(response.body);
JobResultModel jsonResponse =
JobResultModel.fromJson(jsonDecode(response.body));
return jsonResponse.results;
}
}
Upvotes: 1
Views: 918
Reputation:
try
import 'dart:convert';
end use
jsonDecode(utf8.decode(response.bodyBytes))
instead of
jsonDecode(response.body)
Upvotes: 4