Re: How to



Alois Goller writes:
 > We (want to) use GTK as front-end for our Python-based tools, running on
 > Linux and Window. As I found, GTK uses UTF-8 for string
 > representation.

(On Windows, that is. On Unix you presumably use GTK 1.2.x, which does
not.)

 > Fine! But how can I open a file once the user entered a filename?

Use g_filename_from_utf8. (Inside #if GLIB_CHECK_VERSION(1,3,0))

 > What I actually would like to have is a function that returns the default
 > encoding used.

You mean for GTK? I think

#if defined(GTK_CHECK_VERSION) && GTK_CHECK_VERSION(1,3,0)
#define USE_UTF8_FOR_GTK_STRINGS
#endif

should work. (There wasn't a GTK_CHECK_VERSION in GTK 1.2., and the so
called "production" GTK+ on Win32 is 1.3.0.) That check should thus
work correctly both for GTK+ 1.2 on Unix, "production" GTK+ 1.3.0 on
Windows, and a future GTK+ 2.0 on both.

--tml




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