about MBCS and unicode in Visual C++ 2005
-
Dear all I have a project which can be both compiled with VC6 and VC 2005 When I compile it by VC6, the content of LPCSTR is one byte per character but when I compile the project under VC2005 , I find that each character of LPCSTR is consist of 2 bytes which first byte contains the character data and second byte contains a "0" in it. thus I cant show the data properly as I want what happened under VC2005 could you please help me how I can overcome this problem. Is is about unicode and MCBS How can I disable it under VC2005 Could you please send me an article for this problem. I want to become more familiar with UNICODE thanks in advance Mahdi
-
Dear all I have a project which can be both compiled with VC6 and VC 2005 When I compile it by VC6, the content of LPCSTR is one byte per character but when I compile the project under VC2005 , I find that each character of LPCSTR is consist of 2 bytes which first byte contains the character data and second byte contains a "0" in it. thus I cant show the data properly as I want what happened under VC2005 could you please help me how I can overcome this problem. Is is about unicode and MCBS How can I disable it under VC2005 Could you please send me an article for this problem. I want to become more familiar with UNICODE thanks in advance Mahdi
I never used 2005, but in 2003 you can right-click your project in solution explorer, select Properties, under General you can set the the character set between unicode, MBCS and unset which basicly means simple, everyday, 1 byte per char strings.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
modified on Saturday, March 7, 2009 4:21 PM
-
Dear all I have a project which can be both compiled with VC6 and VC 2005 When I compile it by VC6, the content of LPCSTR is one byte per character but when I compile the project under VC2005 , I find that each character of LPCSTR is consist of 2 bytes which first byte contains the character data and second byte contains a "0" in it. thus I cant show the data properly as I want what happened under VC2005 could you please help me how I can overcome this problem. Is is about unicode and MCBS How can I disable it under VC2005 Could you please send me an article for this problem. I want to become more familiar with UNICODE thanks in advance Mahdi
Yes, it is about
UNICODE
andMBCS
as you correctly suspected. VC6 by default does not useUNICODE
, but VC 2005 usedUNICODE
as the default. You can disable this throughProject -> Properties -> Configuration Properties -> General -> Character Set
. Here you can choose betweenUNICODE
andMBCS
. On the other side, you can show the data or do any manipulation onUNICODE
characters. You just need to use the wide version of the functions or the _t macros.«_Superman_» I love work. It gives me something to do between weekends.