Author Topic: Why Unicode?  (Read 6963 times)

kjliew

  • Guest
Why Unicode?
« on: December 07, 2005, 04:02:46 pm »
Can someone educate me the advantage of a Unicode compliant IDE, instead of plain ASCII? Do all the build tools currently support source files in Unicode? (GCC, MSVC etc.) I am kind of confused. An major role of IDE is just managing source files and build process, which are mostly plain ASCII. We don't need Unicode compliant IDE to build Unicode applications.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Why Unicode?
« Reply #1 on: December 07, 2005, 04:08:43 pm »
We don't need Unicode compliant IDE to build Unicode applications.
How do you
a) display menus and dialogs in <random>chinese</random> without Unicode?
b) edit sources that contain character strings in <random>arabian</random> without an editor that handles Unicode?

EDIT:
You may want to go to http://sourceforge.jp/ and browse any random project's CVS tree using a non-Unicode Browser
« Last Edit: December 07, 2005, 04:21:21 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

  • Guest
Re: Why Unicode?
« Reply #2 on: December 07, 2005, 04:15:49 pm »
I agree that most common code is done in ANSI. There are some tools that support files in Unicode (MSVC 2005 for example).
But anyways, you appart from the ability of writing source code, with the IDE can edit resources or plaint text files (which are commonly only in ASCII if they're written english, all other languages are better off with Unicode).

The world is towards Unicode, so I can guess in 10 years everything will be in Unicode.

But, all of that, it's not the main reason of why Code::Blocks is in Unicode.
It was made Unicode compliant because most linux distros now only distributes binary packages of wxWidgets in Unicode mode, not ASCII mode.

BTW, you can compile if you want wxWidgets in ASCII mode, so C::B will be in ASCII mode too (but fear that in some distant future... ASCII will be something of the past  :)).

takeshimiya

  • Guest
Re: Why Unicode?
« Reply #3 on: December 07, 2005, 04:23:20 pm »
BTW, I have another different questions:

Can someone enlightme on how to use STL string/wstring in my programs and switch between ASCII and UNICODE builds using only a #define statement?

How to use gettext for localization with the STL string?

Also, I don't want to use std::cout streans for printing, because it's not i10n-friendly.
So, There's something like wxString::Format() or wxString::Printf()?

Always talking of a C++ way of course (not C).

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Why Unicode?
« Reply #4 on: December 07, 2005, 04:52:49 pm »
BTW, I have another different questions:

Can someone enlightme on how to use STL string/wstring in my programs and switch between ASCII and UNICODE builds using only a #define statement?
May be something likes this:

Code
/////////////////////////////////////////////////////////////////////////////
// tstring. Simple typedef for native STL "string" class but uses TCHAR so
// is ASCII/Unicode independent
/////////////////////////////////////////////////////////////////////////////
#ifndef _UNICODE
// ASCII
typedef std::string tstring;
typedef std::ostringstream tstringstream;
#else
// UNICODE
typedef std::wstring tstring;
typedef std::wostringstream tstringstream;
#endif

The source of the above code is here: http://www.codeguru.com/forum/archive/index.php/t-161213.html

Michael

takeshimiya

  • Guest
Re: Why Unicode?
« Reply #5 on: December 07, 2005, 05:00:34 pm »
lol, I thought the same name (tstring).

And what about i10n?

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Why Unicode?
« Reply #6 on: December 07, 2005, 05:19:40 pm »
And what about i10n?

Hmmm. Until now I have found nothing relevant about an alternative for the std::cout streams.

May be these links could be somehow helpful (may be just a bit):

http://www.codeproject.com/cpp/unicode.asp
http://www.codeproject.com/vcpp/stl/upgradingstlappstounicode.asp
http://www.codeguru.com/Cpp/Cpp/string/alts/article.php/c5643/#Formatting

Best wishes,
Michael

takeshimiya

  • Guest
Re: Why Unicode?
« Reply #7 on: December 07, 2005, 05:23:47 pm »
I see... as the motto says "STL, designed by english speakers, for english speakers"...

Anyone knows a reasonable alternative for std::cout streams?

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Why Unicode?
« Reply #8 on: December 07, 2005, 05:26:38 pm »
Anyone knows a reasonable alternative for std::cout streams?
May be this could be helpful (just found it):

http://www.codecomments.com/message980439.htm

Michael

takeshimiya

  • Guest
Re: Why Unicode?
« Reply #9 on: December 07, 2005, 05:42:12 pm »
Then may I ask... Do you know any work 'wrapping' the needed STL classes (string, files) to make them Unicode happy? And perhaps with cross-platform abilities?

I'm thinking of something like wxWidgets but without all the GUI stuff and templatized.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Why Unicode?
« Reply #10 on: December 07, 2005, 06:18:36 pm »
Then may I ask... Do you know any work 'wrapping' the needed STL classes (string, files) to make them Unicode happy? And perhaps with cross-platform abilities?

I'm thinking of something like wxWidgets but without all the GUI stuff and templatized.
I have searched for a good string class some time ago, because unhappy with std:string, C string, wxString and so on. All this string classes have advantages, but I found rather difficult to combine their advantages by using several classes together (e.g., due to conversion problems). Unfortunately, I did not found the perfect class :(. Anyway, you can have a look at here. May be you will find something suitable for your need:

-Universal STL-Based Template String Class (http://www.codeguru.com/Cpp/Cpp/string/alts/article.php/c5643/#Formatting)

-CStdString (http://home.earthlink.net/~jmoleary/stdstring.htm)

-Str Library (http://www.utilitycode.com/str/default.aspx).
But I do not remeber if this one is open source

-http://www.codeproject.com/string/
Information about string, string classes implementation, etc.

Michael