T
tschmittldk
Hey guys... I had an issue today in the university which i really dont
understand:
char c = '\xc3' or '\xc4' ect... its about lead bytes in UTF8....
now i tried to compare several times:
if(c == '\xc3')
if((unsigned int)c == 0xc3)
if((int)c == 0xc3)
if((unsigned int)c == (unsigned int)0xc3)
All of them negate and go on. But when i do a very stupid bitwise
comparison before it works:
if(((unsigned int)c & 0xc3) == 0xc3)
can anyone explain that to me? I really don't get the difference
betweet if(((unsigned int)c & 0xc3) == 0xc3) and if((unsigned int)c ==
0xc3).
Best regards
Tobias
understand:
char c = '\xc3' or '\xc4' ect... its about lead bytes in UTF8....
now i tried to compare several times:
if(c == '\xc3')
if((unsigned int)c == 0xc3)
if((int)c == 0xc3)
if((unsigned int)c == (unsigned int)0xc3)
All of them negate and go on. But when i do a very stupid bitwise
comparison before it works:
if(((unsigned int)c & 0xc3) == 0xc3)
can anyone explain that to me? I really don't get the difference
betweet if(((unsigned int)c & 0xc3) == 0xc3) and if((unsigned int)c ==
0xc3).
Best regards
Tobias