string literals of different character encodings
I am trying to create string literals of different character encodings:
1) UTF-8 string literal (using prefix u8"string")
2) char16_t string literal (using prefix u"string")
3) char32_t string literal (using prefix U"string")
4) wchar_t string literal (using prefix L"string")
The program compiles and runs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include <iostream>
using namespace std;
auto hu8 = u8"Hello, World!";
auto hu = u"Hello, World!";
auto hU = U"Hello, World!";
auto hw = L"Hello, World!";
int main()
{
cout << hu8 << endl;
cout << hu << endl;
cout << hU << endl;
cout << hw << endl;
}
|
https://ideone.com/cY2V6E
However, the O/P is correct only for the UTF-8 literal:
Hello, World!
0x2b011084eb60
0x2b011084eb28
0x2b011084eb28
|
Does this happen because char16_t, char32_t and wchar_t aren't supported?
This uses the gcc 6.33 compiler.
Thanks.
Topic archived. No new replies allowed.