Re: gtk2, gettext and accentuated characters...




On Tue, 13 Jan 2004, Tim [iso-8859-1] Müller wrote:

On Tuesday 13 January 2004 00:48, Vincent Torri invite Th. Colin wrote:

Well, Everything works fine except accentuated characters. For
exemple,
instead of é, i get two characters that are not on my keyboard :)

(snip)

"Content-Type: text/plain; charset=iso-8859-1\n"

(snip)

root_menu = gtk_menu_item_new_with_mnemonic
(g_locale_to_utf8(_("_Preferences"), -1, NULL, NULL, NULL));

As far as I can see, this assumes that the user's locale is actually set to 
ISO-8859-1 (i.e. the same character set encoding that you use in your .po 
file), which need not necessarily be the case [*]. You can save yourself a 
lot of trouble if you use UTF-8 encoding for your .po files from the start.

Also note that the above code leaks memory, as g_locale_to_utf8() returns a 
newly-allocated string.

Cheers
-Tim

[*] it could be set to UTF-8 for example, in which case g_locale_to_utf8() 
wouldn't do anything at all, and you would end up passing the ISO-8859-1 
encoded string from the .po file to a function that expects an UTF-8 encoded 
string.


OK, it works now. Thanks ! I don't understand well unicode, but it works
:) 

i really think that there should be a doc/howto about gtk, autoconf,
gettext, and utf8. I have succeeded thanks to an howto, several programs,
some mailing lists (and the po files of gtk). And your help.
Perhaps i will write it one day.

Vincent TORRI




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