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 think it has something to do with the so called translation environment and execution environment, as defined in C standards. The ISO C 1999 standard only requires the toolset to implement 92 printable characters (with no mention of the ASCII encoding). Anything beyond that is an extension of the standard. The developers of the toolset are free to implement those extensions as they please.
    Hopefully this answers the "Why ... ?" question.

    Regards,
    - mike

Reply
  • I think it has something to do with the so called translation environment and execution environment, as defined in C standards. The ISO C 1999 standard only requires the toolset to implement 92 printable characters (with no mention of the ASCII encoding). Anything beyond that is an extension of the standard. The developers of the toolset are free to implement those extensions as they please.
    Hopefully this answers the "Why ... ?" question.

    Regards,
    - mike

Children
  • The codes for (and even the presence of) ("æ Æ Ø ø å Â") vary from keyboard to keyboard. In countries where they are commonly used they are implemented as substitutions (if my memory serves me correctly in Denmark '$' print as "Ø") Anything abve 7f and certainly æ Æ Ø ø å Â is NOT ASCII (remember 'A' im ASCII stan for 'American').

    Erik