?
Solved

UNICODE MFC very newbie :) VC6

Posted on 2003-10-27
8
Medium Priority
?
997 Views
Last Modified: 2013-12-03
Hi Experts

Im am thinking of writting for many languages. I know there is UNICODE.
But what about the how?


I read there are TCHAT and _T( ) and the Macro..  

How do I choose what language to display the text as?

Also are there any Turorials on the topic.

Thanks
Barry
0
Comment
Question by:barryhs
5 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 1000 total points
ID: 9631936
Try these links

http://www.codeproject.com/cpp/unicode.asp - Unicode, MBCS and Generic text mappings
http://www.codeproject.com/tips/internationalization.asp - Tips on internationalization of software

Good luck
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9631960
http://www.codeproject.com/cpp/switch_languages.asp - Multilingual Application - Change Application Language
0
 
LVL 8

Expert Comment

by:_corey_
ID: 9637493
Did you install VS6 with UNICODE support? If not, reinstall.
0
 

Author Comment

by:barryhs
ID: 9647089
Hi thanks so far...

What is the reason for specifying the entry point symbol in your Project settings as wWinMainCRTStartup??

Ok the rest of the stuff I knew of..
Basicaly UNICODE is is almost a style ..
eg: _T() and changeing funtion names bla bla...

I Need a realy specific answer then..
Lets say I want the letter to be in a string, or title or in a CStatic , that is equal to the letters "yi" when I set my language to Japanese?

Please dont asume I know anything. Rather tell me everything.

Thanks
again Barry

0
 
LVL 6

Expert Comment

by:purpleblob
ID: 9663214
Basically _T and TCHAR are simply #defines which, depending upon your build will be single or double byte.

Now the point is that this means that if you build for UNICODE and deploy in a language that uses UNICODE then all your chars will actually be wchar_t in size meaning that the UNICODE strings are interpreted/displayed correctly. UNICODE is easy as is single byte character sets as each character is of uniform size. Where things get complicated is on MBCS (multi-byte character sets) whereby a character length may be char in size or wchar_t in size. With these character sets things get tricky as a character string may have a one byte character followed by a two followed by a one etc.

Okay so, the basic problem is now out of the way. if you try and use STL to store your strings, then this can only (from my recollection under VC++ 6) handle uniform character sizes and the MFC CString class, whilst able to handle MBCS has some funcitonality that doesn't work correctly - this is why I ended writing my own string class when I last did this stuff.

The problem is specifically if you wish to iterate through a "string", i.e. if you've a MBCS with different size characters, then you cannot simply go

for(int i = 0; i < _tstrlen(buf); i++)
{
  ... =  buff[i];
}

As this will expect each character to be of the same size. You need to use functions such as  _tcsnextc to get the next character (whether it be a single or double byte character).

Basically you'll need to review the tstr or _tstr type functions as these are #define'd to use either the single, multi or wide char versions of these functions.

Or if you do not need to support non-UNICODE versions of Windows then simply recompile everything for UNICODE :-)

Hope this helps
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question