颤动文本中出现无效的阿拉伯语/波斯语单词

Alo*_*lok 2 utf-8 flutter

我正在尝试将来自 api 的正确阿拉伯语/波斯语单词显示到我的Text(). 就英语而言,它表现得很好,但随着语言的变化,它会返回类似 LATIN1 的内容。

\n\n

Latin1 显示阿拉伯语单词

\n\n

我已经按照这个问题来纠正我的问题:InvalidrabiccharlesWithUtf-8charsetRetrived withhttp.getFlutter\n

\n\n

我有一个name来自 API 的字符串。它的酒吧名称为:Bar Beirut - \xd8\xa8\xd8\xa7\xd8\xb1 \xd8\xa8\xd9\x8a\xd8\xb1\xd9\x88\xd8\xaa。但在回复中,我得到了上面的屏幕截图。

\n\n

我尝试先对字符串进行编码,然后对其进行解码,但没有成功。

\n\n
var encoded = utf8.encode(data[\'name\']);\nthis.name = utf8.decode(encoded);\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以我this.name在我的 中使用Text(),但它显示英语字符,而对于阿拉伯语,它显示 LATIN1。任何帮助,将不胜感激。谢谢

\n

Sam*_*ani 6

尝试以下操作,它对我来说适用于阿拉伯字符

return http.get(Uri.encodeFull(baseUrl), headers: {
      "Content-Type": "application/json",
    }).then((response) {
      return json.decode(utf8.decode(response.bodyBytes));
    });
Run Code Online (Sandbox Code Playgroud)