[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

porting multi-platform (windows, unix, inux) c++ application  to unicode

Posted on 2008-11-06
9
Medium Priority
?
720 Views
Last Modified: 2013-11-20
I'm looking for the best resources to assist me in scoping out a project to convert a sizable multiplatform C++ application to use unicode text.  also any information on what needs to be addressed/changed in the code to enable unicode text would also be useful.  i may initially attempt this on the windows mfc version.  i've been starting to try to compile modules with the /D_UNICODE and /DUNICODE compilation options to start to see what problems i'm going to run into but i feel the scope of the project could be quite large.  i've also been doing some reading and wonder about the value of books like Unicode Explained by Jukka Korpela ann Unicode Demystified by Richard Gillam.
0
Comment
Question by:BarryFromBoston
  • 5
  • 2
  • 2
9 Comments
 
LVL 62

Expert Comment

by:gheist
ID: 22903484
MFC is not portable. No need to waste time on that.
0
 

Author Comment

by:BarryFromBoston
ID: 22904955
What I'm talking about is an adaptation of the code to handle UNICODE text (not a platform port) .  The entire application, written in C and C++ now handles only single byte text and multi-byte text.  The MFC portion of the application only runs on Windows but there is an X based GUI that works on all platforms (Windows, Unix and Linux).  the idea will be to display text on all platforms using the UNICODE characters code numbering.
0
 

Assisted Solution

by:UTEK
UTEK earned 800 total points
ID: 22905036
Really depends on how your application is written.  If your application has a lot of byte char manipulation operations , then good luck!  If it is MFC and you mostly use CString, you probably will be OK by compiing your code in UNICODE format with some changes...Either way, one thing for sure, it won't be small operation.  

I ran into a project that required me to handle UNICODE string in a program that is not compiled in UNICODE...at the end, due to too many changes and time required to compile it in UNICODE, I ended up keeping the program in ANSI, but modify a small portion to make use of the wide char operations to get the job done...for now...

These articles help me to understand UNICODE operations in C++/MFC
1. Generic-Text Route Mappings in the old MSDN
2. http://www.codeproject.com/KB/string/cppstringguide1.aspx
http://www.codeproject.com/KB/string/cppstringguide2.aspx

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:BarryFromBoston
ID: 22905814
Thanks UTEK for your input and reference to the articles.  The more i learn about UNICODE the better off i will be.  What wide character operations could you do without actually compiling the code with UNICODE support.

I was still kind of hoping to hear from someone who has actually adapted an application to UNICODE completely, not just partially.  Also as my application is multi-platform i was hoping to hear from experts on the Unix/Linux side of the house (to which i also posted this question).
0
 

Assisted Solution

by:UTEK
UTEK earned 800 total points
ID: 22906451
Basically, the wchar_t is a cross-platform Unicode character unit that work in windows and Unix.  If you look into the Generic-Text Route Mapping in MSDN library, a lot of wcsXXXX functions are ANSI compatible(avoid Microsoft specific).  You just need to include the right header file and you don't need the UNICODE option in your window compilation.

A brief google search can land you a lot of info in these areas.
e,g http://forums.devx.com/archive/index.php/t-94157.html
0
 

Author Comment

by:BarryFromBoston
ID: 22907324
Now you have my interest peaked.  So i have some follow up questions.  

1. Are you trying to say that it is possible to get at text using the unicode character codes but without compiling the code with the UNICODE symbol defined?  If so can you give me an example of code that does this?  This sounds miraculous and may help me considerably.
2. You keep saying to look at the "Generic-Text Route Mapping" in the MSDN library.  Is that actually a subsection of the library somewhere?  I found sections titled "Generic-Text Routine Mappings" which i think mostly boil down to the routine declarations from tchar.h with much better descriptions.
0
 

Author Comment

by:BarryFromBoston
ID: 22925649
More follow up questions:

One of my objectives with this conversion to UNICODE is to be able to have the user input characters from any language into text strings.  I had been hoping that i might be able to get my CEdit MFC-based dialog compiled for MBCS to enable this.  The more i read and think about it the more unlikely i'm thinking this will work.  So I'm thinking i may need to convert the entire MFC portion of our application to UNICODE in order to get this level of functionality.  I would still like to keep the bulk of non-GUI code from needing to know about UNICODE.

Is it possible to build just the MFC portion UNICODE and leave the rest SBCS as long as i'm cognizant of the translation that will be required?

And are there any known metrics about how long one could expect such an endeavor to take - based on something like lines of code or KB of code?

Thanks.
0
 
LVL 62

Expert Comment

by:gheist
ID: 22926020
You can have Unicode capable UI and convert transparently for unaware backend - but imagine e.g cyrillic languages where backend will get equal input from different unicode strings.

I wonder if MIME-encoded ANSI strings can be produced from GUI. But then again - they will be hard to understand on old GUIs...
0
 

Accepted Solution

by:
BarryFromBoston earned 0 total points
ID: 22952541
I have determined that i need to only support UNICODE on the Windows platform.  I have also decided to implement UNICODE support in primarilly the MFC portion of the application as the user will interact with the application using the MFC-based GUI.  I will need to store UNICODE strings in our persistent database and may need to utilize the UNICODE strings in the non-GUI portion but will deal with that on a case-by-case basis.  

I decided to make my own guess as to how long this adaptation to UNICODE will take me based in part on how long it has taken me to change a set of source files and given how many total source files may be affected.

I would like to extend my thanks to UTEK for the assistance given.  The references supplied were educational.  I am now closing this issue as i am proceeding with my own solution.  Only time will tell if it works.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

868 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