Original Post
Hi all
I have a problem with Visual Studio 2005 and Windows.
Perhaps someone (probably someone outside the US) could confirm this problem:
When I compile a C++ program and try to display a non-US UNICODE character, such as a german "ä" or "ü", etc. Windows XP seems unable to display such characters, but only when UNICODE is ENABLED!!!
Isn't that weirder than hell?
I'm talking about characters ONLY, not about strings (not C++ strings and not C-style zero-terminated strings). You know the type that uses only one single char or wchar_t and should be displayable with the C-style format specifier %c in printf(), sprintf(), etc.
When I set the character encoding of my project to "None specified" or "Multi-Byte", just anything BUT "Unicode", german "ä", "ö", etc. are displayed fine. But as soon as I set the properties of the project to "Unicode", I get just weird signs like the famous empty box.
Here's the short code snippet that does this weirdness.
Can someone please confirm this and does someone know what's amiss here:
Here's my output:
OUTPUT in Message Box when compiled WITH UNICODE:
------------------------
String: computer
Character: "BOX" (unable to display this character!)
Integer: 35
Real: 1.732053
Unicode characters in string: ä ö ü
------------------------
OUTPUT in Message Box when compiled WITHOUT UNICODE:
------------------------
String: computer
Character: ä
Integer: 35
Real: 1.732053
Unicode characters in string: ä ö ü
------------------------
Any help appreciated!
:-(
Mark
I have a problem with Visual Studio 2005 and Windows.
Perhaps someone (probably someone outside the US) could confirm this problem:
When I compile a C++ program and try to display a non-US UNICODE character, such as a german "ä" or "ü", etc. Windows XP seems unable to display such characters, but only when UNICODE is ENABLED!!!
Isn't that weirder than hell?
I'm talking about characters ONLY, not about strings (not C++ strings and not C-style zero-terminated strings). You know the type that uses only one single char or wchar_t and should be displayable with the C-style format specifier %c in printf(), sprintf(), etc.
When I set the character encoding of my project to "None specified" or "Multi-Byte", just anything BUT "Unicode", german "ä", "ö", etc. are displayed fine. But as soon as I set the properties of the project to "Unicode", I get just weird signs like the famous empty box.
Here's the short code snippet that does this weirdness.
Can someone please confirm this and does someone know what's amiss here:
#include <Tchar.h>
// _stprintf test:
TCHAR buffer[200];
TCHAR c = 'ä';
TCHAR s[] = TEXT("computer");
int i = 35, j;
float fp = 1.7320534f;
// Format and print various data:
j = _stprintf( buffer, TEXT(" String: %s\n"), s );
j += _stprintf( buffer + j, TEXT(" Character: %c\n"), c );
j += _stprintf( buffer + j, TEXT(" Integer: %d\n"), i );
j += _stprintf( buffer + j, TEXT(" Real: %f\n"), fp );
j += _stprintf( buffer + j, TEXT("Unicode characters in string: ä ö ü \n"), fp );
MessageBox(NULL, buffer, TEXT("_stprintf test - MessageBox"), 0);
// END: _stprintf test
Here's my output:
OUTPUT in Message Box when compiled WITH UNICODE:
------------------------
String: computer
Character: "BOX" (unable to display this character!)
Integer: 35
Real: 1.732053
Unicode characters in string: ä ö ü
------------------------
OUTPUT in Message Box when compiled WITHOUT UNICODE:
------------------------
String: computer
Character: ä
Integer: 35
Real: 1.732053
Unicode characters in string: ä ö ü
------------------------
Any help appreciated!
:-(
Mark