0

I am trying to print to console. I tried printf("\u0394"); but got the following error:

../Src/main.c(322): warning: #3488-D: Unicode character with hex value 394 not representable in the system default code page.

Am I missing an #include or #pragma require to use Unicode with uVision v5?

What is the system default code page?

Dorian
  • 11
  • 3
  • Note that there's generally no guarantee that Unicode characters _under_ U+00FF can be printed either. C defines a _basic character set_ with 52 letters, 10 digits, and 29 special characters. Those are all in ASCII, and therefore below U+007F. The range U+0080 to U+00FF is Latin-1, and that might be unprintable in C. – MSalters Feb 08 '19 at 16:12

2 Answers2

0

Keil's compiler is for embedded systems, and as such the notion of a "console" is a bit limited. You need to figure out how your console really works. There are some display modules that simply have a hardcoded ASCII character set in ROM; they're not going to display ∆ no matter what you do.

MSalters
  • 173,980
  • 10
  • 155
  • 350
0

Your code page could be anything since you haven't described the operating environment.

One thing code pages do is map the bytes 0-255 to specific Unicode code points. Since there are at most 1,114,112 Unicode code points, you'll only be able to print the 256 characters mapped to whatever your code page is. The Unicode characters don't have to be U+0000 to U+00FF for bytes 0-255 (unless the code page is ISO-8859-1 aka latin1, where that actually is the mapping). See, for example, code page 1252.

Mark Tolonen
  • 166,664
  • 26
  • 169
  • 251
  • It does appear to be mapped to latin1. I just assumed there had to be more than just U+00FF available. – Dorian Feb 11 '19 at 16:53