Re: iconv()



On Mon, 2003-05-19 at 04:58, Tom Garland wrote:
> Hi.
> 
> 1.
> Do you know to what extent gnome/gtk apps already support codeset
> conversion (presumably using iconv() or higher level wrappers)?

Well, whether apps support it or not is really up to the app.
GLib provides a range of facilities for codeset conversion:

 g_convert(), g_io_channel_set_encoding(), g_get_charset()
 g_locale_to/from_utf8(), g_iconv(), ...

Which are considerably easier to use and more portable than
raw usage of iconv.

> 2.
> would codeset conversion be carried out seamlessly when pulling in data
> from the underlying OS? 
> 
> For example. If a user logged into Solaris in say an 8859-7 locale and
> was running an application on gnome that manipulated date and time
> information. Say that date and time information was retrieved from the
> system using strftime(). The output would be encoded in 8859-7 and would
> therefore need to be converted to UTF-8 by the gnome/gtk app in order to
> be displayed. Right?. Does that conversation happen seamlessly? In
> otherwords does the developer need to specifically check to find out
> what the codeset of the OS is, load the correct converters, and do the
> conversion? Or, does gnome/gtk automatically do it?

No, it isn't seamless. To be "seamless", GTK+ would have to override
dozens of libc functions, which would not be at all kosher.

g_locale_to_utf8() usually provides a very easy way of doing
conversions.

In some cases, there are GLib functions that wrap the system
function and do the conversion for the app; g_strerror() and
g_date_strftime() come time mind.

Regards,
                                       Owe





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