From: John Darrington Date: Thu, 6 May 2010 07:21:07 +0000 (+0200) Subject: Don't convert values returned from gettext to UTF8. X-Git-Tag: v0.7.5~38 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=871d078bcc3029284551e2400a58bd5ece2064f3;p=pspp-builds.git Don't convert values returned from gettext to UTF8. Because we have called bind_text_domain_codeset, gettext always returns strings in UTF8 encoding. It's therefore not correct to convert them again. Thanks to Michel Boaventura for reporting this problem. --- diff --git a/src/ui/gui/psppire-var-store.c b/src/ui/gui/psppire-var-store.c index 403eba84..1a2fc1fc 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 (gettext (type_label[VT_DATE]), -1, 0, 0, err); + return xstrdup (gettext (type_label[VT_DATE])); break; case FMT_DOLLAR: - return g_locale_to_utf8 (gettext (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/var-display.c b/src/ui/gui/var-display.c index 7081e9e2..1b9bf71c 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]); } @@ -34,7 +33,7 @@ missing_values_to_string (const PsppireDict *dict, const struct variable *pv, GE gchar *s; const struct missing_values *miss = var_get_missing_values (pv); if ( mv_is_empty (miss)) - return g_locale_to_utf8 (gettext (none), -1, 0, 0, err); + return xstrdup (gettext (none)); else { if ( ! mv_has_range (miss)) diff --git a/src/ui/gui/variable-info-dialog.c b/src/ui/gui/variable-info-dialog.c index cbc4d5ca..6d494495 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 */