Re: GTK Apis unicode support ?



On Mon, 5 Jul 2004, Dipak G Patil wrote:

> Hi,
>
> I am new to Linux and porting a application from windows to linux using
> GTK.
> As in windows there are always two versions of any API one for Ascii (e.g
> CreateWindowExA) and other for unicode(el CreateWindowExW).

No, it is not for ASCII but for "ANSI", that is, 8-bit encodings/charsets.
That side of the windows API is actually extended to also handle some
types of variable-length/multi-byte encodings/charsets, in other words it
is a nuisance to use correctly in Windows.

> Does the APIs of GTK library support both unicode and ASCII or I will have
> to do something for that ?

GTK+ uses UTF8.  If you need to convert to/from UTF8 and other
encodings/charsets you can use the iconv library in the Linux/*BSD world.
GTK+ has some wrappers for this which you are supposed to use, so I only
mention the iconv library because you might need it for other purposes in
the Linux/*BSD world.

Some of the GTK+ wrappers around iconv is used to convert to/from the
current locale and UTF8... the current locale may very well be set to an
encoding/charset that is different from UTF8.  On my PC the current locale
uses ISO 8859-1 (also known as ISO Latin-1 which is /almost/ identical to
Windows CP-1252 if I remember correctly).

If you need to know more about UTF8/unicode, please google for Markus
Kuhn's Unicode FAQ (skip the sections where he turns into a standards
lawyer).

-Peter



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]