CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* This code switches to UTF-?? with 1 preprocessor line but it seems to be affecting the wrong stream
1. uncomment #line to send byte-order-mark (a side-effect
of dumping filename on errors/warnings/messages)
...then do #2 to prove something got switched */
//#line 0 "\xfe\xff" // second parm is filename for error reports
#include <iostream> // printf, ...
int main() {
printf( "1:[%s]", "⛵");
wprintf(L"2:[%s]", "☺"); //"\u2728\U00008966");
// 2. uncomment to see error in utf-16??
//crash();
return 0;
}
// ? other attempts at sending BOM to stdout/stderr
// #pragma message "\xfe\xff ?" ⛵
// #warning ⛵ // needs BOM first
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run