I get the ascii code from a char like this (using C langage):
char * text = "5°";
int sizeText = strlen(text);
int i = 0;
float asciiCode;
for(i=0; i<sizeText; i++) {
asciiCode = (GLfloat)text[i];
}
It's working well for the ASCII table (chars number 0 to 127) but it's not working with characters from the extended ASCII table. For example I get -62 from this symbol "°" (it should be 248).
I tried with several encoding like UTF-8 and ISO 8859-1 (I'm using eclipse cdt btw), I got a different ASCII code each time but not the good one :/
Do you have any idea why it is not working? How can I get it work?
Thanks.
float
? If I doprintf("5°")
it works just fine. The problem is you're assigning a signed character248
(which is equivalent to -62 as a number) to afloat
which is keeping it as-62
and now it's just a number.. – lurkerchar
is platform dependent. – Bathsheba