Quantcast
Channel: Flutter - Character encoding is not behaving as expected - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Flutter - Character encoding is not behaving as expected

$
0
0

I am parsing a local JSON file that has words containing rarely used special characters in Icelandic.

When displaying the characters I get mixed up symbols but not the characters, for some others I just get a square instead of a symbol.

I am using this type of encoding "\u00c3"

Update: Example of the characters I am using: þ, æ, ý, ð

Q: What is the best way to display those kind of characters and avoid any chance of display failures?

Update #2:How I am parsing:

Future<Null> getAll() async{    var response = await     DefaultAssetBundle.of(context).loadString('assets/json/dictionary.json');    var decodedData = json.decode(response);    setState(() {      for(Map word in decodedData){        mWordsList.add(Words.fromJson(word));      }    });  }

The class:

class Words{  final int id;  final String wordEn, wordIsl;  Words({this.id, this.wordEn, this.wordIsl});  factory Words.fromJson(Map<String, dynamic> json){    return new Words(      id: json['wordId'],      wordEn: json['englishWord'],      wordIsl: json['icelandicWord']    );  }}

JSON Model:

{"wordId": 47,"englishWord": "Age",    //Here's a String that has two special characters"icelandicWord": "\u00c3\u00a6vi"}

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images