Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-03-2006, 05:46 AM   #1
Registered: Dec 2005
Distribution: suse/lfs/ubuntu
Posts: 46

Rep: Reputation: 15
simple c-problem(unicode)

i'm just writing a small program to convert a text document into an html-document and am having trouble with certain characters, for example the german umlaute (ä etc.).

i've written and saved the text file in UTF-8 and i've also written the programm in UTF-8. now gcc issues a warning when i try to compile it, that the umlaute ( in utf-8 form e.g. , etc.) are being regarded as multi-characters

int main()
int zeichen;


is my diagnosis correct, that gcc is probably trying to turn this into 7-bit ascii and therefore getting confused with the ''? if so, how do i tell gcc to read a file as if it's UTF-8?

i do realise that this isn't a very critical problem, and what i'm trying to do is much more easily achieved using a short sed-program

Old 05-03-2006, 07:24 AM   #2
Senior Member
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Unicode is a multi byte character encoding so in C you will need to convert your Unicode file from the format it has been stored in (probably utf7 or utf8) to wide characters and then work with them, before saving the file you will then need to convert it back to an appropriate file format.

Personal experience has taught me to use libraries rather than using C directly, or you could look at a language that supports Unicode directly - there are many.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unicode banajah Linux - General 1 04-25-2006 12:04 AM
Unicode kalleanka General 2 03-03-2006 04:58 PM
problem : Keybard mapping to unicode using c++ djadhav Programming 0 05-30-2004 03:46 AM
Unicode Problem bullstrong Linux - Software 1 11-18-2003 02:07 PM
Unicode ?? Help 80s Debian 1 11-02-2003 07:27 AM

All times are GMT -5. The time now is 10:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration