Comment 2 for bug 1083076

Revision history for this message
Vladimir Zhbanov (vzhbanov) wrote :

Hi, I have two solutions for this. One of them actually works :)
See the patches attached below.

The first of them changes the codeset used in gschem. I tried it
in mixed environment (in my system, the default locale is
ru_RU.UTF-8, but I used the koi8rxterm program from the xterm
package and LANG=ru_RU.KOI8-R; the 'mixed environment' means that
in this case gschem still writes text files using UTF-8).

However, with this patch gschem outputs many
  Gtk-WARNING **: Invalid input string
and segfaults. gdb says:
  Segmentation fault.
  0xb77e7108 in g_markup_escape_text () from /lib/libglib-2.0.so.0
I don't know why, maybe because of the mixed environment, or just
libglib doesn't support KOI8-R now.

I cannot check the patch on a clean system but I believe what I
have tried with LANG=KOI8-R is enough to consider this way wrong.

The second patch just resets the internal gschem encoding to C if
a user uses any non-UTF-8 encoding. I consider this to be better
since
  1) I believe we aim at universality and want to support UTF-8
     anywhere so we have to by all means encourage users to do it
     and force them to throw out their obsolete other encodings.
  2) it doesn't segfault :)

In order to quickly check how it works you may add the following
string somewhere in gschem:
  #define DEBUG 1
and run it in your terminal with changed LANG (you have to install
a new locale which will be used first). gschem will output some
info.