Char C question about encoding signed/unsigned.

Posted by drigoSkalWalker on Stack Overflow See other posts from Stack Overflow or by drigoSkalWalker
Published on 2010-03-26T15:05:25Z Indexed on 2010/03/26 15:13 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

Hi guys.

I read that C not define if a char is signed or unsigned, and in GCC page this says that it can be signed on x86 and unsigned in PowerPPC and ARM.

Okey, I'm writing a program with GLIB that define char as gchar (not more than it, only a way for standardization).

My question is, what about UTF-8? It use more than an block of memory?

Say that I have a variable

unsigned char *string = "My string with UTF8 enconding ~> çã";

See, if I declare my variable as

unsigned

I will have only 127 values (so my program will to store more blocks of mem) or the UTF-8 change to negative too?

Sorry if I can't explain it correctly, but I think that i is a bit complex.

NOTE: Thanks for all answer

I don't understand how it is interpreted normally.

I think that like ascii, if I have a signed and unsigned char on my program, the strings have diferently values, and it leads to confuse, imagine it in utf8 so.

© Stack Overflow or respective owner

Related posts about c

    Related posts about utf-8