Failed to print euro symbol in program "C"

I can not print the euro symbol. The program I use is below.

I set the character set to code page 1250 , which has 0x80 for the euro symbol.

Program
=======

#include <stdio.h> #include <locale.h> int main() { printf("Current locale is: %s\n", setlocale (LC_ALL, ".1250")); printf("Euro character: %c\n", 0x80); getchar(); return 0; } 

Output
======
Current Location: English_India.1250
Euro character :?
Other details
==============
OS: Windows Vista
Compiler: vC ++ 2008 express edition

+4
source share
3 answers

Read this: http://www.columbia.edu/~em36/wpdos/eurodos.html

There are sections that can help you:

  • Display the Euro symbol in full-screen DOS and consoles in Windows NT, 2000 or XP.
  • Display the euro symbol in DOS and the command console windows in Windows 2000 and XP (native TrueType font support)
  • Euro display in DOS and command consoles in Windows 2000 and XP (raster and TrueType fonts)
+3
source

0x80 char is falsely referred to as the euro sign, this is Padding Char. See here: http://bugs.mysql.com/bug.php?id=28263

If I remember correctly, it should something around 0x120, try typing in a for loop from 120 to 130

+3
source
 #include <stdio.h> int main() { printf("\u20AC"); return 0; } 

I used the GCC compiler and it works great. Output: €


This only works with C ++ and C99

+2
source

All Articles