我的问题:我想用 StreamWriter 写数据(我的字符串包含字母 é 和 è),但它不起作用。没有这个字母,它可以工作。
错误:无法关闭流
我的代码:
string postString = "id=" + sIdTransaction + "&nom=" + sNom + "&prenom=" + sPrenom + "&email=" + sEmail + "&adresse.rue=" + sRue + "&adresse.codePostal=" + sCodePostal + "&adresse.ville=" + sVille;
string sIdContractant = "";
Encoding iso = Encoding.GetEncoding("utf-8");
Encoding utf8 = Encoding.UTF8;
byte[] utfBytes = utf8.GetBytes(postString);
byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
postString = iso.GetString(isoBytes);
string sUrlAuth = "https://test.contralia.fr/Contralia/api/transactions/" + sIdTransaction + "/contractant/";
HttpWebRequest webRequest = CreationRequete(sUrlAuth);
webRequest.ContentLength = postString.Length;
StreamWriter requestWriter = new StreamWriter(webRequest.GetRequestStream());
requestWriter.Write(postString);
requestWriter.Close();
adresse.Ville = Fercé(这个问题有问题)
请问我该如何解决这个问题?
谢谢