This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Printf problem with special characters like: æ Æ Ø ø å Â

Hello everyone,

I have a problem storing special characters with uVision editor.
When I store the following line which stand in a example.c file:

 printf("æ Æ Ø ø å Â");
it is converted to incorrect ASCII values.

I can solved the problem by replacing the line and use the correct ASCII value as hex codes:

 printf("\x91 \x92 \x9D \x9B \x86 \xB6");
Then of course it is working fine but not very readable.

Why converts uVision these special characters and why do I not have this problem with other C-editors like UltaEdit?

(I use uVision2 v2.4)

Parents
  • "I have a problem storing special characters with uVision editor."

    No. You have a misunderstanding of exactly what ASCII defines and does not define.
    This is nothing to do with Keil, uVision, 'C', printf, ...

    "it is converted to incorrect ASCII values."

    They are not valid ASCII codes at all - so what you actually get is undefined!

    ASCII defines only code 0-127 (7 bits); there are many extensions to ASCII that use code 128-255 - but you need to define precisely which extension you're using if you want to be sure of what you'll get.

    printf does not directly support this.

Reply
  • "I have a problem storing special characters with uVision editor."

    No. You have a misunderstanding of exactly what ASCII defines and does not define.
    This is nothing to do with Keil, uVision, 'C', printf, ...

    "it is converted to incorrect ASCII values."

    They are not valid ASCII codes at all - so what you actually get is undefined!

    ASCII defines only code 0-127 (7 bits); there are many extensions to ASCII that use code 128-255 - but you need to define precisely which extension you're using if you want to be sure of what you'll get.

    printf does not directly support this.

Children