- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So here's a silly issue that I can't seem to find a good answer to after a frustrating attempt and search of the net/forums.
I have some simple code, that wants to print some unicode characters (sample drastically reduced):
cout << "hi " << "\\u2596" << " there" << endl ;
And it works just fine in gcc:
hi there
But icc spits a warning:
warning #27: character value is out of range
cout << "hi " << "\\u2596" << " there" << endl ;
^
And then doesn't print the correct character:
hi \\uffff there
I can work around it by doing:
char qux[] = {0xe2, 0x96, 0x96, 0x00};
cout << "hi " << qux << " there" << endl;
Where the sequence of characters is the internal representation of the symbol, and it ends up printing the right thing for both compilers, but depends on the terminal doing the right thing. It feels awful to do, though, and means destructing any unicode symbols we're using.
Clearly it doesn't seem like the correct workaround, but I'm at a loss for anything else to try. I've use casting, wcout (still produces a warning, and no output), L"\\u..." (still invalid symbol), and various combinations, all to no avail. Any other smart ideas out there?
Thanks in advance.
I have some simple code, that wants to print some unicode characters (sample drastically reduced):
cout << "hi " << "\\u2596" << " there" << endl ;
And it works just fine in gcc:
hi there
But icc spits a warning:
warning #27: character value is out of range
cout << "hi " << "\\u2596" << " there" << endl ;
^
And then doesn't print the correct character:
hi \\uffff there
I can work around it by doing:
char qux[] = {0xe2, 0x96, 0x96, 0x00};
cout << "hi " << qux << " there" << endl;
Where the sequence of characters is the internal representation of the symbol, and it ends up printing the right thing for both compilers, but depends on the terminal doing the right thing. It feels awful to do, though, and means destructing any unicode symbols we're using.
Clearly it doesn't seem like the correct workaround, but I'm at a loss for anything else to try. I've use casting, wcout (still produces a warning, and no output), L"\\u..." (still invalid symbol), and various combinations, all to no avail. Any other smart ideas out there?
Thanks in advance.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
*bump* Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like a bug :-)
We have entered this into our bug database and I'll let you know when we have a fix. If we come up with a better workaround, I'll let you know.
Sorry for the inconvenience.
Dale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is an old thread, but I'd like to add a note here to bring everyone to the same page: this issue has been fixed a while back from 13.1 and later.
Thanks,
Jennifer
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page