当我的头部值包含重音符号时,我收到这个错误:Unhandled Exception: FormatException: Invalid HTTP header field
,例如 village_name=moapé。
如何对头部进行编码以避免此问题。这是我的代码:
Map<String, String> headers = {"Content-type": "application/json", "cookie": cookies};
http.Response response = await http.get(url, headers: headers);