0

Having read tutorials and books on C, I am trying hard to connect my knowledge of UTF (as the text format for roman letters and all sorts of other alphabets/scripts) with C, as a programming language used all over the world.

C seems to take ASCII characters.

So if I wanted to write a program with input/output in Chinese,say, how would I implement this with C?

Joe
  • 41,484
  • 20
  • 104
  • 125

2 Answers2

2

You would be using "wide char" wchar instead of char.

http://en.wikipedia.org/wiki/Wide_character
http://pubs.opengroup.org/onlinepubs/007908799/xsh/wchar.h.html
http://msdn.microsoft.com/en-us/library/aa242983(v=vs.60).aspx

There are also specialized libraries like iconv that help on some platforms.

clyfe
  • 23,695
  • 8
  • 85
  • 109
1

It's character encoding, not text formatting. If you want to use UTF in C, you can use a library to handle it (see e.g. here for UTF-8 libraries: Light C Unicode Library). If you're writing a GUI program, your GUI library probably has facilities to handle it (GTK, KDE, wxWidgets and Tk all support Unicode).

Community
  • 1
  • 1
Staven
  • 3,113
  • 16
  • 20