RE: Just a few UTF8 questions...



On Tue, 8 Jul 2003 martyn 2 russell bt com wrote:

If you had written:

  str = g_strdup_printf("Rødgrød med fløde"); /* phrase used by Danes to
tease foreigners */

it wouldn't be.

If you wanted to put this string into a GtkTextView (or use it with anything
in GTK) how would you do it then if it wasn't valid UFT8?

I think I would write it in UTF8 in the first place...

In this case I can also fix it with a simple loop around
g_unichar_to_utf8() because ø is in 8859-1 :)

The generic fix, however, is to use g_locale_to_utf8() which I didn't
bother to look up for you earlier.  Make sure you set the locale correctly
first (the docs are clear on that).  What is not obvious is that you need
a bunch of support files installed for this to work (with glibc).  Maybe
you have them, maybe you don't.

Another way would be to use the iconv program.

Both g_locale_to_utf8() and iconv are ultimately wrappers around
iconv_open(), iconv(3), iconv_close().

I'm afraid there is no real way around having to learn about all this
pesky ISO 10646 stuff... and get your translators to use UTF8, too.

-Peter




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