0

Well I'm using Flutter v1.15.2 (Dart 2.8.0) on Dev Channel to create a web app.

I'm doing a request to a "remote" API, and this API returns a Json with some data. Into this data there is a field called 'title' that sometimes contains special characters as the letter 'ñ'.

The thing is that I'm converting this Json object into a Map in the usual way with a class like:

class Similar {
  final String title;

  Similar(this.title);

  Similar.fromJson(Map<String, dynamic> json)
    :title = json['title']
     ...;

For example the API returns this word: 'CAÑAVERAL'
But, this is what flutter shows in the view instead of CAÑAVERAL: IMAGE

I don't find any solution to this in internet. Please HELP!

EDIT:
The user @RichardHeap gave the answer to the problem I had in this other Question: Flutter fetched Japanese character from server decoded wrong

ThankYou So much

  • Have you tried something with ut8 encode/decode ? Something like this should resolve the problem: https://stackoverflow.com/questions/51101471/how-can-i-convert-string-to-utf8-in-dart – huextrat Feb 11 '20 at 14:32
  • Yes, a tried in the Similar.fromJson body put "title = utf8.decode(utf8.encode(json['title']))", but the same serialized text was returned. – Aron Forero Feb 11 '20 at 15:41
  • Thanks to the user @Richard Heap for the association to the question https://stackoverflow.com/questions/51368663/flutter-fetched-japanese-character-from-server-decoded-wrong That is the correct answer to my problem. Thank You Very Much. – Aron Forero Feb 11 '20 at 19:50

0 Answers0