Solved

UNICODE MFC very newbie :) VC6

Posted on 2003-10-27
8
970 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error email attachment VB2010 5 56
GUI: DIalog Stacking and Popping in MS C++ 4 96
SSIS 2010 Convert to SSIS 2013 On Different Box 3 63
Explain Unit of Work pattern 2 86
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 …
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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