ASCII extended characters won't be written/coded properly :o(((

Vincent Trouilliez vincent.trouilliez at
Sat Sep 10 12:03:28 UTC 2005

Hi chaps,

I am having an extremely annoying problem, that's driving me so mad, I
am about to commit suicide I think, or become depressive at least :

I recently started programming embedded 8 bit microcontrollers (Atmel
AVR) thanks to avr-gcc, avr-libc mostly.
To write the C source code I simply use Gedit as I find it perfectly
suited to the task....until today :-/

My problem is that it doesn't seem to code extended ASCII characters
properly. For example when I define a constant string that happens to
include an extended character (which is very often, as all accented
characters are >127, and all the special characters to draw tables/cells
for example) :

const string[] = "Encore planté...";

int main (void) {
printf("%s", string);

the accented character, 'é', is normally extended ASCII code 0x82.
Well, after chasing some weird bug in my program which would incorrectly
display this string on an ASCII terminal, I eventually found that the
program was fine, but that the problem was on the computer side. I
looked at the source file using a binary editor, and realised that the
'é', supposedly 0x82, was actually coded as TWO bytes : "C3 A9" ! 
That's using the default UTF-8 encoding. I then thought of asking Gedit
to save the source file using the old European encoding "Western ISO
8859-15". Using this encoding, Gedit coded the 'é' as "E9", a single
byte at last, but still not correct !! So when the controller prints my
strings to an ASCII terminal, I don't get the expected characters !

So basically I pretty much can't use strings in my programs...
"annoying"... to say the least. :-/

I tried using simpler text editors, like nano or vi but they all are
having the same problem.

The last thing I expected was for bloody ASCII characters to cause
problems ! :o((((

If someone can help me put my Ubuntu straight, so I can just write
strings in my programs and get them back as they look in the source
code, I would be TRULY grateful ! :o(

Hoping someone in the know is reading this... :o(


Vince, surprised, shocked and depressed...

More information about the ubuntu-users mailing list