CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 31

Thread: Cross Platform Internationalization Concerns

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Posts
    384

    Cross Platform Internationalization Concerns

    Hi,

    I am currently in the process of developing a software which is to be supported on both Windows (XP, Vista) and Unix (Solaris, Linux) for both the US and Japanese markets. The product is purely in C++.

    [1]
    What are the considerations while starting to develop cross platform internationalized software using C++ ?
    Note - I am concerned with cross platform considerations with respect to writing internationalized software on C++.

    [2]
    Does using the w* (wchar_t, wstring etc) family in your code automatically mean that you are targetting build on the UNICODE environment ?

  2. #2
    Join Date
    May 2008
    Posts
    96

    Re: Cross Platform Internationalization Concerns

    [1]
    You will need to become familiar with the C++ locale and facet objects.
    Googling "c++ internationalization" gets some good hits too.

    A book that might be worth your getting is Standard C++ IOStreams and Locales: Advanced Programmer's Guide and Reference by Angelika Langer and Klaus Kreft.

    [2]
    No. It is just a bunch of bits. What matters is how you use them. So if you use wchar_t to handle 16-bit unicode strings, then yes.
    http://www.cprogramming.com/tutorial/unicode.html
    http://www.microsoft.com/globaldev/g...g_unicode.mspx
    http://www.cl.cam.ac.uk/~mgk25/unicode.html

    It might also be worth a google of "c++" and "unicode" and "ucs".

    Hope this helps.

  3. #3
    Join Date
    Jan 2006
    Posts
    384

    Re: Cross Platform Internationalization Concerns

    With regard to [2] - Does this mean that in Visual Studio for example, you have have MBCS are your compiler directive and still use wchar_t ?
    If this happens, what happens to originally single byte characters (ASCII range for example) which would have been 1 byte in MBCS ? Is this represented as 2 bytes in wchar ?

  4. #4
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: Cross Platform Internationalization Concerns

    In short, do not use anything that the compiler gives you in terms of unicode support. This is mostly non-standard so not portable.

    Now, it depends on how much your software needs to "understand" international strings. If you just have to display a few messages, use wchar_t and convert it when you have to output something (most linux terminals use utf-8, so you can't output the wchar_t directly).

    If you have to know when a word ends and the next one starts, count characters, make uppercase or lowercase letters etc. then forget about a simple approach. Use something like ICU to handle all your strings. It's a very heavy library but totally worth it in the long run if you have to do non trivial stuff with Unicode strings.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  5. #5
    Join Date
    Jan 2006
    Posts
    384

    Re: Cross Platform Internationalization Concerns

    Thanks for the answers.
    I do have a case where I will need to read from a file containing Japanese strings (with separators like comma etc.). I would need to read these contents and create data entities in memory.
    This is the only case where I foresee parsing.
    Hence, do you still recommend using the wide char family on both Windows and Unix ?

    Do you need to have special considerations in choosing between UNICODE and MBCS considering that this application (currently targetting the 32-bit platform) will soon need to be ported to the 64 bit platform on both Windows and Unix.

  6. #6
    Join Date
    Jan 2006
    Posts
    384

    Re: Cross Platform Internationalization Concerns

    I am still undecided on which option to choose (MBCS or UNICODE) but for the reference of other readers - here's another viewpoint in simple words

    http://www.tech-archive.net/Archive/.../msg00160.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)