std::string s("??<");
std::cout << s << std::endl;
Why does that output { instead of ??<
I'm using Visual Studio 2008. I'm assume it's encoding it but why and what is the encoding called if that is what's happening?
This little %#$^*! caused me to look for a bug in my (unit test) code for 30 minutes before I figured out my string was mangled!! :(
Because of trigraphs.
These are the supported trigraphs, from the Wikipedia page:
??= → #
??/ → \
??' → ^
??( → [
??) → ]
??! → |
??< → {
??> → }
??- → ~
For Visual Studio, according to the documentation trigraphs are turned off by default (sensibly enough), so check your project/makefiles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With