It is just a miss match of font definitions.
There is no fix as such because of the way your computer works. Is it a PC? What operating system are you using?
The best bet is if you forget about strings and just use the ASCII to do a numerical compair.
Yes it's a PC and I use Windows 7 64 bits, and I was wrong about the ASCII value 130, I edited my post. Strange problem :~
Edit: Not sure why, but if I do:
if ((byte)c == 233) c = 195;
Then the string comparison will work.
I got the value 195 by doing
char test[] = "olé";
Serial.println( test[2] );
Which printed 'Ã', that is 195 in the ASCII table, and that is 233 - 38... While substracting 38 worked for 'é', it doesn't work for other accentized characters... I will update this post later if I find more about this problem
Perhaps peeking at the Reference page for the char data type would prove useful. What is the range of values that can be stored in a char? It might surprise you.
PaulS, maybe you can explain what you mean, I know a char can store -127 to + 127 or whatever that is...But if I change the data type to a byte array or int array then how do I use it with strncmp?
Anyway... I think I'm close of getting something working:
PaulS, maybe you can explain what you mean, I know a char can store -127 to + 127 or whatever that is
Then you should also know that values like 195, 233, etc. can NOT be (successfully) stored.
But if I change the data type to a byte array or int array then how do I use it with strncmp?
You can't. You can, however, write your own function that does the same thing with unsigned char arrays, or byte arrays, or whatever data type that you find works to hold YOUR data.
All that strncmp() is doing is looping up to n times comparing values in the ith position of two arrays. It returns as soon as a non-match is found.
guix:
Do you know how I can fix the problem? Thanks in advance!
The standard ASCII character set only covers values in the range 0 - 127. There are multiple definitions for values outside this range. In Microsoft Windows, these are termed 'code pages'. If you're using values outside the standard set then the sender and receiver would need to agree what definition (or 'code page') they are using. I suspect the problem in this case is that the sender (PC) and receiver (Arduino runtime library) do not agree.
PeterH, ok that's what I thought, is there a way to change the code page used by the Arduino ??
There really isn't a "code page" for the Arduino. A code page defines how to stroke the characters on a display device. You've probably noted that there is no display device on the Arduino.