broken i18n printing in gedit and gnumeric



Hello,

I was trying to make gnumeric and gedit print Czech characters on FreeBSD
with no success, and after few hours of investigation I found out, that
both rely on mbstowcs() functions, which don't work as expected on
FreeBSD. In the i18n patch from Vlad Harchev, the function mbstowcs is
used to convert a string from current locale's encoding to unicode. This
works on linux (glibc), but I believe it is not correct (in the mean of
portability), because multibyte(3) functions are supposed to be used to
convert multibyte encodings (like Japanese) and not ISO8859-x charsets
etc.  In fact, on FreeBSD it doesn't convert current locale to unicode,
but ascii to unicode. I was consulting it on freebsd mailing lists and
this was the answer:

====cut================================================================

I know that ISO8859-2 is not multibyte encoding, but in fact gnumeric,
gedit (and I believe a lot of other software) expect the multibyte
functions to work anyway (and to work as "translate characters from
current locale's encoding to UNICODE" and reverse).

They are broken.  (Or perhaps they are relying on new behavior in C99,
but I rather doubt it.)

Why does this work in linux ?

Because Linux (or rather, glibc) implements it the way these broken
programs expect.

-GAWollman

===cut=================================================================

Wouldn't it be possible to use another method to convert a string
in current locale's encoding to utf8 ? For example glib.h function:
g_locale_to_utf8() ?

Bye

Tomas Pluskal










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