在C#WebApi中,嘗試以json格式接收阿拉伯文數據(通過肥皂UI發送),我收到「???」而不是實際的阿拉伯文字。C#RESTful WebApi在json中使用阿拉伯語發佈數據但接收?
網址:
http://localhost:4321/receive/message
JSON格式(請求):
{
"message_no";"123",
"user_id":"a123",
"text":"أهلا بك",
}
型號:
public class MessageBody
{
[JsonProperty(PropertyName = "message_no")]
public string MessageNo { get; set; }
[JsonProperty(PropertyName = "user_id")]
public int UserId { get; set; }
[JsonProperty(PropertyName = "text")]
public int Text { get; set; }
}
內容接收:
MessageNo:123
用戶ID:A123
文本:??????
在服務器端和客戶端都使用'UTF-8'編碼器嗎? –
現在我沒有使用任何編碼器,您能提供關於如何在服務器端使用'UTF-8'編碼的示例代碼嗎? – FaizanRabbani
當你從chrome瀏覽器打開這個URL時,你看到了什麼?(假設這是一個GET請求)? – Developer