Thread: Is a guide to (portable) use of unicode for idiots out there?

  1. #1
    Registered User
    Join Date
    Nov 2006

    Is a guide to (portable) use of unicode for idiots out there?


    I read the whole day on google about making apps unicode ready. the more i read the more i got lost. wchar, tchar, main, tmain, winmain, cout, wcout, uc2, utf8, multibyte, std or external libs, the next say one has to do nothing if the OS has unicodesupport included...argh

    Do you know a little tutorial about how to write unicode aware apps on hello-world-level or slightely above that a portable at least between winXP+ and an actual linux? Best would be with little examples showing 1. this is the best way to handle input/output 2. processing/converting that strings internally or something like that.

    thank you in advance!

  2. #2
    Registered User
    Join Date
    May 2003
    There's very little in the way of portable Unicode, especially because different operating systems use different types of Unicode; Linux uses UTF-8 (where a string is an array of 8 bit characters), while Win2000/NT/Vista use UTF-16 (where a string is an array of 16 bit characters).

    The only way to get true "portability" would be with conditional compilation; e.g.

    #ifdef WIN32
    typedef std::wstring unicodestring
    typedef std::string unicodestring
    and just do that in every place that absolutely needs OS-specific features to work.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM
  2. Unicode - a lot of confusion...
    By Jumper in forum Windows Programming
    Replies: 11
    Last Post: 07-05-2004, 07:59 AM
  3. Should I go to unicode?
    By nickname_changed in forum C++ Programming
    Replies: 10
    Last Post: 10-13-2003, 11:37 AM
  4. printing non-ASCII characters (in unicode)
    By dbaryl in forum C Programming
    Replies: 1
    Last Post: 10-25-2002, 01:00 PM
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM