0

For some reason VS swaps "£" for "?"

For instance: cout << "Price: £" << price << endl;

outputs:

Price: ?xx.xx

Doesn't matter where I place a "£", it always outputs a "?"

Anybody got any idea what this is?!

Sunny
  • 1
  • 1
    Related: https://stackoverflow.com/questions/3831289/inserting-a-%C2%A3-sign-in-an-output-string-in-c – Omry Nov 28 '20 at 19:00
  • the character encoding of your source file probably doesn't match the character set of your console. Please show a [mre] – Alan Birtles Nov 28 '20 at 19:01
  • Visual Studio doesn't do anything like that. `?` will only appear if a file is saved as ASCII using the wrong codepage. This can happen with *any* application and is essentially a coding bug.. I wonder what codepage was used as `£` appears in almost all codepages. – Panagiotis Kanavos Nov 28 '20 at 19:02
  • In any case, post your code. Almost certainly, you aren't using Unicode strings (ie u16string/char16_t or wstring/wchar in older versions of the language). Windows strings are UTF16 and applications are expected to use Unicode since the late 1990s – Panagiotis Kanavos Nov 28 '20 at 19:05
  • Works on my machine. I'm using UTF-16 output, from UTF-8 strings. Is that what you are using? – Eljay Nov 28 '20 at 19:29

0 Answers0