對於這段代碼:字符編碼
String content = String.Empty;
ListenerStateObject state = (ListenerStateObject)ar.AsyncState;
Socket handler = state.workSocket;
int bytesRead = handler.EndReceive(ar);
if (bytesRead > 0)
{
state.sb.Append(Encoding.UTF8.GetString(state.buffer, 0, bytesRead));
content = state.sb.ToString();
...
我歌廳 '011?'而不是'Olá'
它有什麼問題?
您的數據可能不是UTF8。 – driis 2011-05-17 11:50:04
更好地顯示state.buffer的確切內容,並且bytesRead – 2011-05-17 14:19:03