Re: gtk2, gettext and accentuated characters...



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.





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