G
Guest
I'm using the following to transfer the content of two strings containing
non-english letters
byte[] responseB = Encoding.ASCII.GetBytes(responseHdr.ToString() +
responseBody.ToString());
But when I receive it, the non-english letters have been replaced by
question marks (?). What could be wrong?
I receive using
clientSocket.BeginReceive(info.buffer, 0, info.buffer.Length, 0, new
AsyncCallback(this.OnReceiveResults), info);
private void OnReceiveResults(IAsyncResult info)
{
//Display the results in the list box
InfoCarrier info_carrier = (InfoCarrier) info.AsyncState;
if (info_carrier.Request_Status == InfoCarrier.mc_ReqStatusOK)
{
m_Lbl_Status.Text = "The results have been successfully fetched.";
listBoxResults.Items.Clear();
const int NOT_FOUND = -1;
int currPos = 0;
int hasNext = info_carrier.Body.IndexOf('\n');
while (hasNext != NOT_FOUND)
{
listBoxResults.Items.Add(info_carrier.Body.Substring(currPos, hasNext -
currPos).Replace('|', '\t'));
currPos = hasNext;
hasNext = info_carrier.Body.IndexOf('\n', hasNext + 1);
}
}
}
In the listbox there are only ?:s instead of the non-english letters.
non-english letters
byte[] responseB = Encoding.ASCII.GetBytes(responseHdr.ToString() +
responseBody.ToString());
But when I receive it, the non-english letters have been replaced by
question marks (?). What could be wrong?
I receive using
clientSocket.BeginReceive(info.buffer, 0, info.buffer.Length, 0, new
AsyncCallback(this.OnReceiveResults), info);
private void OnReceiveResults(IAsyncResult info)
{
//Display the results in the list box
InfoCarrier info_carrier = (InfoCarrier) info.AsyncState;
if (info_carrier.Request_Status == InfoCarrier.mc_ReqStatusOK)
{
m_Lbl_Status.Text = "The results have been successfully fetched.";
listBoxResults.Items.Clear();
const int NOT_FOUND = -1;
int currPos = 0;
int hasNext = info_carrier.Body.IndexOf('\n');
while (hasNext != NOT_FOUND)
{
listBoxResults.Items.Add(info_carrier.Body.Substring(currPos, hasNext -
currPos).Replace('|', '\t'));
currPos = hasNext;
hasNext = info_carrier.Body.IndexOf('\n', hasNext + 1);
}
}
}
In the listbox there are only ?:s instead of the non-english letters.