2

I couldn't display a 'bullet' of character code DEC 149 which can be found on ASCII Chart.

cout << char(149) << endl;

it comes out as ò on console window. I know a few characters from charmap that I'd like to use but how would i know their character codes?

David Thornley
  • 56,304
  • 9
  • 91
  • 158
Carl17
  • 23
  • 1
  • 3

2 Answers2

0

The problem is that ASCII only defines character codes 0 through 127. If you want to use codes above that, then you need to specify an ANSI code page. The chart you referenced is using the Latin-1 code page and your console is apparently using something else.

You need to set your console code page to Latin-1 for your characters to display as desired. There's no standard C++ way to do this. If you're programming on Windows, you can use the SetConsoleOutputCP() function. The code page id for Latin-1 on Windows is 1252.

Peter Ruderman
  • 12,241
  • 1
  • 36
  • 58
  • Standard C++ doesn't have a way to do this; the standard way would be to use `std::wcout`. Unfortunately that appears a bit broken on VC++ – MSalters Jun 22 '10 at 08:40
0

To get the Unicode character codes you can look them up in the Unicode code charts.

decodeunicode.org is nice for interactive browsing.

starblue
  • 55,348
  • 14
  • 97
  • 151