N
Nuno Magalhaes
Why does (in the code below) the message should appear as "keep-alive -
keep-alive - test" but it only appears as "keep-alive - keep-alive".
That is why the last comparation (Equals) isn't getting true. Is it
from the "Convert.ToByte('\0')" that does the comparation false?
I'm shure that the strings are identical but it gives me false. Why?
Any help is appreciated, (Possible some UTF8 compatibility issues?)
Nuno Magalhaes.
Here's the code:
***************************************************************
byte[] connectionBytes=new byte[16];
for(int i1=index+12,i2=0;;i1++,i2++)
{
if(bytes[i1]=='\n')
{
connectionBytes[i2]=Convert.ToByte('\0');
break;
}
connectionBytes[i2]=bytes[i1];
}
string strTemp=Encoding.UTF8.GetString(connectionBytes).ToLower();
MessageBox.Show("keep-alive - "+strTemp+" - test");
if(Encoding.UTF8.GetString(connectionBytes).ToLower().Equals("keep-alive"))keepAlive=true;
else keepAlive=false;
keep-alive - test" but it only appears as "keep-alive - keep-alive".
That is why the last comparation (Equals) isn't getting true. Is it
from the "Convert.ToByte('\0')" that does the comparation false?
I'm shure that the strings are identical but it gives me false. Why?
Any help is appreciated, (Possible some UTF8 compatibility issues?)
Nuno Magalhaes.
Here's the code:
***************************************************************
byte[] connectionBytes=new byte[16];
for(int i1=index+12,i2=0;;i1++,i2++)
{
if(bytes[i1]=='\n')
{
connectionBytes[i2]=Convert.ToByte('\0');
break;
}
connectionBytes[i2]=bytes[i1];
}
string strTemp=Encoding.UTF8.GetString(connectionBytes).ToLower();
MessageBox.Show("keep-alive - "+strTemp+" - test");
if(Encoding.UTF8.GetString(connectionBytes).ToLower().Equals("keep-alive"))keepAlive=true;
else keepAlive=false;