Re: how to set language for non-unicode text



I wrote my first linux GUI app using GTK+, which seems to be a very
nice tool.

Well, GTK+ is not a "tool" but a library, also called a "tooolkit", so
I wonder whether what you actually have been using some higher level
GUI application or "toolt" to write code that uses GTK+? Anyway, let's
assume that was just an accidental use of the wrong word.

ÂOne question I had is: how can I set the language for non-unicode text in my application?

That question doesn't really make sense, as

1) GTK+ accepts only Unicode text (in particular, encoded as UTF-8)

2) Even if text is in Unicode it needs language-dependeng handling
(especially for text in Chinese, Japanese or Korean, where
language-specific fonts should be used even if the code points for the
ideographs are unified). Anyway, as such it isn't really GTK+ that
needs to know the language of some text, but Pango. (Another library,
that GTK+ uses to layout text.) See for instance
http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html .

ÂI tried to use iconv(), but did not work out. The iconv_open call returned error ENOENT (2). ÂNot sure
if i am in the correct direction.

Well, if you suspect that iconv() is what you need, then probably
indeed it is. How to use iconv() is not really a GTK+ question, you
just need to read its documentation carefully. Note that iconv() is
not related to *languages* as such, but codesets and encodings. (But
yeah, many codesets and encodings are specifically used for one
language in one country, or a closely related group of languages.)
Also note that GLib has a convenience API on top of iconv() to make it
a bit friendlier to use, see
http://library.gnome.org/devel/glib/stable/glib-Character-Set-Conversion.html
.

I suspect you need to give us more details of what your problem
actually is. Where do the strings come from that you tried to use
iconv() on? Do you know what language they are? Do you know what
codeset and encoding they are? What do you need to do with them?

--tml



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