Reputation: 2097
I get some input from the command line and want to support Unicode.
This is my error:
And this is my example code:
#include <iostream>
int main() {
char test = '█';
}
// Characters wanted: █, ▓, or ▒
How can I make my program support Unicode?
Upvotes: 1
Views: 445
Reputation: 509
A char
is usually only 1 byte, meaning it won't be able to store most Unicode characters. You should look into using wchar_t
which is required to be large enough to hold any supported character codepoint. The associated char literal looks as follows: L'█'
.
Upvotes: 4