Solved

UNICODE MFC very newbie :) VC6

Posted on 2003-10-27
8
967 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
8 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 250 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Read the sort values being used for tasks in a Microsoft Project schedule? 4 47
Example of WebAPI 7 35
String manipulation in Visual Basic 7 81
Problem to file 3 91
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

713 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