- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the following line of code in a source file that sets the text of a dialog button:
m_okBtn->SetWindowTextW(L"") ; // Note 'L'
The Microsoft 2008 compiles this and produces an OK button with as the text.
Regardless of what encoding I save the file with (except UTF-16 which you don't support) the Intel compiler translates the character string and so results in a button with garbage in it ().
In order to work around it, I have to write the following code for Intel C++:
[cpp]void _setWindowItem(CWnd* wnd, const char* utf8Text) { if ( wnd == NULL ) return ; wchar_t buffer[512] ; UTF8::ConvertChars(utf8Text, buffer, sizeof(utf8Text)) ; wnd->SetWindowTextW(buffer) ; } ... _setWindowItem(m_okBtn, "") ; // Note: No L [/cpp]Any ideas what is causing this? Yes, the project is set to use Unicode character set.
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can't seem to find any means of telling ICC that a source file is not in ISO-8859-1. Anyone know if this is planned for a future feature?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icl does support unicode/ multi-byte.
which icl version are you using? is your program a MFC app or atl app? I'll create one simple testcase to find out.
Jennifer
which icl version are you using? is your program a MFC app or atl app? I'll create one simple testcase to find out.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I created a mfc dlg app, and set the dlg title to "L""", it works. But I have to save the .cpp file into Unicode.
is your .cpp file in unicode format?
is your .cpp file in unicode format?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I should have mentioned that I'm using the Parallel Composer beta, used following code:
[cpp] SetWindowTextW(L"") ; // Note 'L' SetDlgItemTextW(IDOK, L"");[/cpp]
You can get the Parallel Composer beta from http://www.intel.com/go/parallel/ .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Jennifer Jiang (Intel)
I created a mfc dlg app, and set the dlg title to "L""", it works. But I have to save the .cpp file into Unicode.
is your .cpp file in unicode format?
is your .cpp file in unicode format?
Compiling with Intel C++ 11.0.066 [IA-32]... (Intel C++ Environment)
The cpp file and all of the h files were in UTF-8, I tried with and without the Microsoft leading bytes. I even tried UTF-16 and I've hex-dumped the files to verify that the characters are actually stored in the file as UTF-8 and I'm not seeing UTF-8 in the different editor scenarios I used (Visual Studio, XCode, CodeBlocks, KDevelop, Anjuta, VIM and VIM via putty configured to UTF-8) to make absolutely sure the characters were actually UTF-8.
[cpp]#includeProduces the exact same result as doing:int main(int argc, char* argv[]) { const wchar_t* foo = L"" ; wprintf(L"%lsn", foo) ; } [/cpp]
[shell]$ echo | iconv --from iso-8859-1 --to utf8 [/shell]
which is, to print:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the simple testcase.
I saw the problem with UTF-8, Unicode. It only works when the file is ANSI. I'll submit a bug report with your testcase.
Thanks,
Jennifer
I saw the problem with UTF-8, Unicode. It only works when the file is ANSI. I'll submit a bug report with your testcase.
Thanks,
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - kfsone
#include
int main(int argc, char* argv[])
{
const wchar_t* foo = L"" ;
wprintf(L"%lsn", foo) ;
}
int main(int argc, char* argv[])
{
const wchar_t* foo = L"" ;
wprintf(L"%lsn", foo) ;
}
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