Code::Blocks Forums

User forums => Help => Topic started by: BennM on December 08, 2006, 04:14:16 pm

Title: I need Unicode!
Post by: BennM on December 08, 2006, 04:14:16 pm
Hi people,

how do I set up Code:Blocks to compile in Unicode oder Ascii-Code? I need some chars like ö ü ä ß for my C-console-project!

Thx
Title: Re: I need Unicode!
Post by: joubertdj on December 08, 2006, 04:22:08 pm
Okay first of... which C::B version are you currently using?
Which operating system?
Which compiler?
Which console?

EDIT: Here is a unicode tutorial: http://www.flipcode.com/articles/article_advstrings01.shtml
Title: Re: I need Unicode!
Post by: BennM on December 08, 2006, 04:29:22 pm
I am using Code:Blocks 1.0RC2 with MINGW compiler under WinXP.
At program start-up I am selcting Create new Console Application (C)
Title: Re: I need Unicode!
Post by: joubertdj on December 08, 2006, 04:30:17 pm
 :shock:
Title: Re: I need Unicode!
Post by: BennM on December 08, 2006, 04:38:11 pm
what's the problem?  :lol:
Title: Re: I need Unicode!
Post by: Der Meister on December 08, 2006, 04:48:52 pm
RC2 is *much* too old. You should try a recent nightly build. As far as I know they are already built as unicode version.
Title: Re: I need Unicode!
Post by: BennM on December 08, 2006, 05:17:06 pm
Where do I get the newer Install-Pack (already compiled for WinXP)?
Title: Re: I need Unicode!
Post by: David Perfors on December 08, 2006, 05:19:51 pm
See the Nightly Build forum (or use the search button :P)
Title: Re: I need Unicode!
Post by: Pecan on December 08, 2006, 05:54:35 pm
   //-- Wiki Index
       CodeBlocks Wiki Index (http://wiki.codeblocks.org/index.php?title=Special:Allpages)
   //-- Wiki Main Page
     CodeBlocks Wiki Main Page (http://wiki.codeblocks.org/index.php?title=Main_Page)
Title: Re: I need Unicode!
Post by: BennM on December 08, 2006, 06:12:00 pm
I've installed the latest version of the nighty builds!
I'm a student, so I haven't enough time to read the whole wiki-article. Could you please tell me how to setup my compiler to interprete ascii or unicode?

At the University we are using code:blocks, but there are a lot of people who don't know more than how to start the computer and run Code:Blocks!!! So the way has to be easy - I have to tell them how it works!
Title: Re: I need Unicode!
Post by: David Perfors on December 08, 2006, 06:20:54 pm
To get those Unicode chars working, you have to use wchar_t instead of char or std::wstring instead of std::string. There are a lot functions where you should use the w (==wide) variant. (I guess that is the problem and not the version of C::B)

When you are using Windows apps, you need to define UNICODE (or something like that) For more information you could better use CodeProject as guide. (and since when students don't have time to read?? :P I am a student to, but I have plenty of time :))
Title: Re: I need Unicode!
Post by: thomas on December 08, 2006, 08:45:41 pm
I'm a student, so I haven't enough time to read the whole wiki-article.
You have to be joking... if students don't have time, then who has...?

Besides, there is nothing you need to do for IDE and compiler to use Unicode. The compiler uses UTF-8 as default encoding, and the nightly builds are Unicode by default, too.
Title: Re: I need Unicode!
Post by: Pecan on December 08, 2006, 09:46:07 pm
I've installed the latest version of the nighty builds!
I'm a student, so I haven't enough time to read the whole wiki-article. Could you please tell me how to setup my compiler to interprete ascii or unicode?

Students should read and do their own homework.

Wish I had Wiki's and Google when I was a student.

We had to haul around books back then, with much less information..
Had to spend hours waiting in line to get to the library catalog drawers. And if it wasn't indexed, more hours in the stacks searching, turning pages, failing, searching some more. Yuck. Thank god the world has changed.
Title: Re: I need Unicode!
Post by: BennM on December 10, 2006, 02:08:37 pm
Codeblocks is "only" a tool for me to do my work - if I had to read a lot of pages for every tool I need, I wouldn't be able to do all my exercises. I study Mechatronik (Mechanical engineering, electro-technology and computer science ) - it's very heavy. A software has to run after installing - no one who needs a tool likes to configure it in many hours, just to compile a few programs! I like this Code:blocks project and the idea of open-source, but it's not very easy to get a working program in short time!
Title: Re: I need Unicode!
Post by: David Perfors on December 10, 2006, 02:16:38 pm
It is easy to get a program working when you read the instructions in the wiki ;) But I agree, a program should work out of the box, or with a minimal amount of configuration
Title: Re: I need Unicode!
Post by: dje on December 10, 2006, 02:51:28 pm
No miracle...

Software you can't configure never match your need and are not used...
Open software that can be used anywhere may be harder to configure and may require a little time to get used, but time is not lost as you can reuse the tool elsewhere.

Just make your choice : spend little time to figure out how wonderful C::B is or be lazy and...
Title: Re: I need Unicode!
Post by: BennM on December 10, 2006, 05:16:51 pm
Quote
Software you can't configure never match your need and are not used...

The user must to be able to configure it for complex exercises or special applications, but basics like unicode should be preinstalled!

Imagine: There are some people who has to learn C / C++ for their study and they don't know anything about computers (maybe surfing in the internet!). These People want to have and URL to download and install the Compiler. After that it has to work for all exercises!

Thats what I want to make you clear!
Title: Re: I need Unicode!
Post by: MortenMacFly on December 10, 2006, 10:45:10 pm
Imagine: There are some people who has to learn C / C++ for their study and they don't know anything about computers (maybe surfing in the internet!).
Well it's the same like applying physics and doesn't knowing anything about Newton, right?
Don't you think before getting into programming a little reading would be helpful? I promise: If you don't invest time into reading/learning before you won't earn anything from it. That's one of the most basis (life) lessons, IMHO.
With regards, Morten.
Title: Re: I need Unicode!
Post by: thomas on December 11, 2006, 09:36:38 am
The user must to be able to configure it for complex exercises or special applications, but basics like unicode should be preinstalled!
Just to clarify once again: Unicode is the default in Code::Blocks as well in gcc/MinGW.

Learning how to program Unicode applications is another issue, the IDE will not do that for you, but I think that's quite clear...