On Wed, May 05, 2010 at 04:45:08AM -0300, Michel Boaventura wrote: > Hello, > > I've talked about this issue some time ago as a bug which affects only > Windows. But now I can reproduce it also on linux. > > If I use Linux with a locale which doesn't use utf8, or on Windows > (which also doesn't uses utf8) the Type of the variables on > psppire appears with strange chars. If I run psppire with a utf8 > charset, the problem disappears. > > Its strange that it only affects the type of the variable. Name, label > and values works fine on both locales. > > with an utf8 locale: http://pspp.michelboaventura.com/files/with.png > without an utf8 locale: http://pspp.michelboaventura.com/files/without.png
This is definitely a bug. Try the attached patch. I've tested it only very briefly. > The same problem happens if I try to open a file with non-ascii chars on > its name. > With non utf8 locales the file just doesn't open. I get a log of errors > on terminal like: > (psppire:19668): Pango-WARNING **: Invalid UTF-8 string passed to > pango_layout_set_text() set the environment variable G_DEBUG to "fatal_warnings". Then run psppire under gdb and try to get a stack trace showing how and where that invalid UTF8 string occurs. J' -- PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://pgp.mit.edu or any PGP keyserver for public key.
diff --git a/src/ui/gui/psppire-var-store.c b/src/ui/gui/psppire-var-store.c
index ece7281..066a2cc 100644
--- a/src/ui/gui/psppire-var-store.c
+++ b/src/ui/gui/psppire-var-store.c
@@ -643,16 +643,16 @@ text_for_column (PsppireVarStore *vs,
switch ( write_spec->type )
{
case FMT_F:
- return g_locale_to_utf8 (gettext (type_label[VT_NUMERIC]), -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_NUMERIC]));
break;
case FMT_COMMA:
- return g_locale_to_utf8 (gettext (type_label[VT_COMMA]), -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_COMMA]));
break;
case FMT_DOT:
- return g_locale_to_utf8 (gettext (type_label[VT_DOT]), -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_DOT]));
break;
case FMT_E:
- return g_locale_to_utf8 (gettext (type_label[VT_SCIENTIFIC]), -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_SCIENTIFIC]));
break;
case FMT_DATE:
case FMT_EDATE:
@@ -667,20 +667,20 @@ text_for_column (PsppireVarStore *vs,
case FMT_DTIME:
case FMT_WKDAY:
case FMT_MONTH:
- return g_locale_to_utf8 (type_label[VT_DATE], -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_DATE]));
break;
case FMT_DOLLAR:
- return g_locale_to_utf8 (type_label[VT_DOLLAR], -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_DOLLAR]));
break;
case FMT_CCA:
case FMT_CCB:
case FMT_CCC:
case FMT_CCD:
case FMT_CCE:
- return g_locale_to_utf8 (gettext (type_label[VT_CUSTOM]), -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_CUSTOM]));
break;
case FMT_A:
- return g_locale_to_utf8 (gettext (type_label[VT_STRING]), -1, 0, 0, err);
+ return xstrdup (gettext (type_label[VT_STRING]));
break;
default:
{
@@ -739,7 +739,7 @@ text_for_column (PsppireVarStore *vs,
case PSPPIRE_VAR_STORE_COL_VALUES:
{
if ( ! var_has_value_labels (pv))
- return g_locale_to_utf8 (gettext (none), -1, 0, 0, err);
+ return xstrdup (gettext (none));
else
{
const struct val_labs *vls = var_get_value_labels (pv);
@@ -762,12 +762,12 @@ text_for_column (PsppireVarStore *vs,
const gint align = var_get_alignment (pv);
g_assert (align < n_ALIGNMENTS);
- return g_locale_to_utf8 (gettext (alignments[align]), -1, 0, 0, err);
+ return xstrdup (gettext (alignments[align]));
}
break;
case PSPPIRE_VAR_STORE_COL_MEASURE:
{
- return measure_to_string (pv, err);
+ return xstrdup (measure_to_string (pv, err));
}
break;
}
diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c
index d75bff3..38a64b6 100644
--- a/src/ui/gui/psppire.c
+++ b/src/ui/gui/psppire.c
@@ -89,6 +89,7 @@ replace_casereader (struct casereader *s)
void
initialize (struct source_stream *ss, const char *data_file)
{
+ int width_unused, height_unused;
PsppireDict *dictionary = 0;
i18n_init ();
@@ -96,7 +97,7 @@ initialize (struct source_stream *ss, const char *data_file)
preregister_widgets ();
gsl_set_error_handler_off ();
- settings_init (&viewer_width, &viewer_length);
+ settings_init (&width_unused, &height_unused);
fh_init ();
the_dataset = create_dataset ();
@@ -116,8 +117,6 @@ initialize (struct source_stream *ss, const char *data_file)
create_icon_factory ();
- psppire_output_window_setup ();
-
journal_enable ();
textdomain (PACKAGE);
diff --git a/src/ui/gui/var-display.c b/src/ui/gui/var-display.c
index 7081e9e..316f840 100644
--- a/src/ui/gui/var-display.c
+++ b/src/ui/gui/var-display.c
@@ -22,8 +22,7 @@ measure_to_string (const struct variable *var, GError **err)
const gint measure = var_get_measure (var);
g_assert (measure < n_MEASURES);
- return g_locale_to_utf8 (gettext (measures[measure]),
- -1, 0, 0, err);
+ return gettext (measures[measure]);
}
diff --git a/src/ui/gui/variable-info-dialog.c b/src/ui/gui/variable-info-dialog.c
index cbc4d5c..6d49449 100644
--- a/src/ui/gui/variable-info-dialog.c
+++ b/src/ui/gui/variable-info-dialog.c
@@ -91,8 +91,6 @@ populate_text (PsppireDictView *treeview, gpointer data)
text = measure_to_string (var, NULL);
g_string_append_printf (gstring, _("Measurement Level: %s\n"),
text);
- g_free (text);
-
/* Value Labels */
signature.asc
Description: Digital signature
_______________________________________________ pspp-dev mailing list [email protected] http://lists.gnu.org/mailman/listinfo/pspp-dev
