On Thu, 19 Apr 2007, Ignacio Diaz-Emparanza wrote:
1-In a gretl console, writing "help command" (for example
"help
ols") I obtain an error box with the text "g_locale_to_utf8
failed for charset 'UTF-8'", I click on "close" and gretl exits.
I've checked this now and I see what you mean. That gretl crashed
on the encoding error was a simple bug, now fixed in CVS. The
encoding error itself is a bit more complex. I'll explain what's
going on and maybe we can out what's the best fix.
When you call for help in the gretl console, the help file that
gets read is the same one used by gretlcli. Traditionally this
has been encoded in ISO-8859-N, because that has been the most
common encoding in Linux terminals (though that is changing now).
But GTK requires UTF-8, so when we display a chunk of the help
file we need to ensure it's in UTF-8, recoding if necessary. In
general, when we're about to display stuff in the console we (a)
check if it's valid UTF-8, and if not then (b) call for recoding.
But recoding from what character set? The assumption up till now
has been: the character set that glib says is in use on the local
system. But on Ubuntu the local system encoding is UTF-8, so
gretl is thoroughly confused: it ends up trying to recode from
UTF-8 to UTF-8, but the help file text is not actually UTF-8 at
all!
One workaround (i.e., should solve your problem right now) would
be to use the "recode" utility to turn gretlcli.hlp.es into UTF-8.
In fact, I think we should probably produce and distribute all
gretl help files in UTF-8, and recode to the local encoding at the
terminal as and when needed (that is, not at all on current
Ubuntu and similar modern Linux systems).
Allin.