convert_xml_string_to_value (struct ccase *c, const struct variable *var,
const xmlChar *xv)
{
- char *text;
int n_bytes = 0;
union value *v = case_data_rw (c, var);
- text = recode_string (CONV_UTF8_TO_PSPP, (const char *) xv, -1);
+ const char *text = (const char *) xv;
if ( text)
n_bytes = MIN (var_get_width (var), strlen (text));
if ( errno != 0 || endptr == text)
v->f = SYSMIS;
}
-
- free (text);
}
struct var_spec
if ( r->node_type == XML_READER_TYPE_TEXT )
{
- char *text ;
xmlChar *value = xmlTextReaderValue (r->xtr);
-
- text = recode_string (CONV_UTF8_TO_PSPP, (const char *) value, -1);
+ const char *text = (const char *) value;
if ( r->row < r->start_row)
{
}
free (value);
- free (text);
}
else if ( r->node_type == XML_READER_TYPE_ELEMENT
&& r->state == STATE_CELL)
#include <langinfo.h>
#endif
-
-static char *locale;
-static char *charset;
-
-
-static iconv_t convertor[n_CONV];
+static char *default_encoding;
/* A wrapper around iconv_open */
The returned string must be freed when no longer required.
*/
char *
-recode_string (enum conv_id how, const char *text, int length)
+recode_string (const char *to, const char *from,
+ const char *text, int length)
{
char *outbuf = 0;
size_t outbufferlength;
char *op ;
size_t inbytes = 0;
size_t outbytes ;
+ iconv_t conv ;
/* FIXME: Need to ensure that this char is valid in the target encoding */
const char fallbackchar = '?';
if ( length == -1 )
length = strlen(text);
- assert (how < n_CONV);
- if (convertor[how] == (iconv_t) -1)
+ if (to == NULL)
+ to = default_encoding;
+
+ if (from == NULL)
+ from = default_encoding;
+
+
+ fprintf (stderr, "from: %s; to %s\n", from, to);
+
+ if ( 0 == strcmp (to, from))
return xstrndup (text, length);
for ( outbufferlength = 1 ; outbufferlength != 0; outbufferlength <<= 1 )
outbytes = outbufferlength;
inbytes = length;
+
+ conv = create_iconv (to, from);
+
do {
const char *ip = text;
- result = iconv (convertor[how], (ICONV_CONST char **) &text, &inbytes,
+ result = iconv (conv, (ICONV_CONST char **) &text, &inbytes,
&op, &outbytes);
if ( -1 == result )
}
} while ( -1 == result );
+
+ iconv_close (conv);
+
if (outbytes == 0 )
{
char *const oldaddr = outbuf;
}
-/* Returns the current PSPP locale */
-const char *
-get_pspp_locale (void)
-{
- assert (locale);
- return locale;
-}
void
i18n_init (void)
{
- assert (!locale) ;
- locale = strdup (setlocale (LC_CTYPE, NULL));
-
- setlocale (LC_CTYPE, locale);
-
- free (charset);
- charset = strdup (locale_charset ());
-
- convertor[CONV_PSPP_TO_UTF8] = create_iconv ("UTF-8", charset);
- convertor[CONV_UTF8_TO_PSPP] = create_iconv (charset, "UTF-8");
+ free (default_encoding);
+ default_encoding = strdup (locale_charset ());
}
void
i18n_done (void)
{
- int i;
- free (locale);
- locale = 0;
-
- for(i = 0 ; i < n_CONV; ++i )
- {
- if ( (iconv_t) -1 == convertor[i] )
- continue;
- iconv_close (convertor[i]);
- }
+ free (default_encoding);
+ default_encoding = NULL;
}
#ifndef I18N_H
#define I18N_H
-const char * get_pspp_locale (void);
-void set_pspp_locale (const char *locale);
-const char * get_pspp_charset (void);
-
void i18n_done (void);
void i18n_init (void);
-enum conv_id
- {
- CONV_PSPP_TO_UTF8,
- CONV_UTF8_TO_PSPP,
- n_CONV
- };
+#define UTF8 "UTF-8"
-char * recode_string (enum conv_id how, const char *text, int len);
+char * recode_string (const char *to, const char *from,
+ const char *text, int len);
/* Return the decimal separator according to the
#include "psppire-var-store.h"
#include "psppire-selector.h"
#include "dialog-common.h"
+#include <libpspp/i18n.h>
#include <language/expressions/public.h>
#include <language/syntax-string-source.h>
gtk_tree_path_free (path);
- name = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
+ name = recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_name (var),
+ -1);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dest));
#include <config.h>
+#include <libpspp/i18n.h>
#include "dialog-common.h"
#include "psppire-var-ptr.h"
var = get_selected_variable (tree_model, iter, dict);
- name = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
+ name = recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_name (var), -1);
g_object_set (cell, "text", name, NULL);
g_free (name);
}
#include "dict-display.h"
#include "psppire-dict.h"
+#include <libpspp/i18n.h>
#include "helper.h"
#include <data/variable.h>
#include <data/format.h>
gtk_tree_path_free (path);
- name = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
+ name = recode_string (UTF8, psppire_dict_encoding (PSPPIRE_DICT (dict)),
+ var_get_name (var), -1);
gtk_entry_set_text (GTK_ENTRY (dest), name);
g_free (name);
}
gtk_tree_path_free (path);
- name = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
+ name = recode_string (UTF8, psppire_dict_encoding (PSPPIRE_DICT (dict)),
+ var_get_name (var), -1);
result = ( 0 == strcmp (text, name));
g_free (name);
return GTK_WIDGET (get_object_assert (builder, name, GTK_TYPE_WIDGET));
}
-/* Converts a string in the pspp locale to utf-8.
- The return value must be freed when no longer required*/
-gchar *
-pspp_locale_to_utf8 (const gchar *text, gssize len, GError **err)
-{
- return recode_string (CONV_PSPP_TO_UTF8, text, len);
-}
-
-gchar *
-utf8_to_pspp_locale (const gchar *text, gssize len, GError **err)
-{
- return recode_string (CONV_UTF8_TO_PSPP, text, len);
-}
-
/* This function must be used whenever a filename generated by glib,
(eg, from gtk_file_chooser_get_filename) and passed to the C library,
(eg through a pspp syntax string).
GtkAction * get_action_assert (GtkBuilder *builder, const gchar *name);
GtkWidget * get_widget_assert (GtkBuilder *builder, const gchar *name);
-/* Converts a string in the pspp locale to utf-8 */
-gchar * pspp_locale_to_utf8 (const gchar *text, gssize len, GError **err);
-gchar * utf8_to_pspp_locale (const gchar *text, gssize len, GError **err);
-
gchar * convert_glib_filename_to_system_filename (const gchar *fname,
GError **err);
-
void connect_help (GtkBuilder *);
void reference_manual (GtkMenuItem *, gpointer);
#include <language/syntax-string-source.h>
#include "psppire-data-store.h"
#include <ui/gui/sheet/psppire-axis-impl.h>
+#include <libpspp/i18n.h>
#include "helper.h"
#include <gtk-contrib/gtkxpaned.h>
gchar *text = g_strdup_printf ("%d: %s", row + FIRST_CASE_NUMBER,
var_get_name (var));
- gchar *s = pspp_locale_to_utf8 (text, -1, 0);
+ gchar *s = recode_string (UTF8,
+ psppire_dict_encoding (data_store->dict),
+ text, -1);
g_free (text);
#include <pango/pango-context.h>
#include "psppire-data-store.h"
+#include <libpspp/i18n.h>
#include "helper.h"
#include <data/dictionary.h>
if (label)
{
free (v);
- return pspp_locale_to_utf8 (label, -1, 0);
+ return recode_string (UTF8, psppire_dict_encoding (store->dict),
+ label, -1);
}
}
FP. No null terminator is appended to the buffer. */
data_out (v, fp, s->str);
- text = pspp_locale_to_utf8 (s->str, fp->w, 0);
+ text = recode_string (UTF8, psppire_dict_encoding (store->dict),
+ s->str, fp->w);
g_string_free (s, TRUE);
g_strchomp (text);
if (row == n_cases)
psppire_data_store_insert_new_case (store, row);
- s = utf8_to_pspp_locale (text, -1, NULL);
+ s = recode_string (psppire_dict_encoding (store->dict), UTF8, text, -1);
psppire_data_store_data_in (store, row,
var_get_case_index (pv), ss_cstr (s),
static gchar *
get_row_button_label (const PsppireSheetModel *model, gint unit)
{
+ PsppireDataStore *ds = PSPPIRE_DATA_STORE (model);
gchar *s = g_strdup_printf (_("%d"), unit + FIRST_CASE_NUMBER);
- gchar *text = pspp_locale_to_utf8 (s, -1, 0);
+ gchar *text = recode_string (UTF8, psppire_dict_encoding (ds->dict),
+ s, -1);
g_free (s);
if ( ! var_has_label (v))
return NULL;
- text = pspp_locale_to_utf8 (var_get_label (v), -1, 0);
+ text = recode_string (UTF8, psppire_dict_encoding (ds->dict),
+ var_get_label (v), -1);
return text;
}
pv = psppire_dict_get_variable (ds->dict, col);
- text = pspp_locale_to_utf8 (var_get_name (pv), -1, 0);
+ text = recode_string (UTF8, psppire_dict_encoding (ds->dict),
+ var_get_name (pv), -1);
return text;
}
#include <data/missing-values.h>
#include <data/value-labels.h>
#include <data/variable.h>
+#include <libpspp/i18n.h>
#include "helper.h"
#include "message-dialog.h"
{
case DICT_TVM_COL_NAME:
{
- gchar *name = pspp_locale_to_utf8(var_get_name (var), -1, NULL);
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, name);
- g_free (name);
+ gchar *name = recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_name (var), -1);
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, name);
+ g_free (name);
}
break;
case DICT_TVM_COL_VAR:
}
}
#endif
+
+
+
+
+const gchar *
+psppire_dict_encoding (const PsppireDict *dict)
+{
+ return NULL;
+}
void psppire_dict_dump (const PsppireDict *);
#endif
+const gchar *psppire_dict_encoding (const PsppireDict *);
+
G_END_DECLS
#endif /* __PSPPIRE_DICT_H__ */
#include "psppire-dict.h"
#include "psppire-conf.h"
#include <data/format.h>
+#include <libpspp/i18n.h>
#include "helper.h"
#include <gettext.h>
)
{
*model = top_model;
- *iter = *top_iter;
+
+ if ( iter)
+ *iter = *top_iter;
while ( ! PSPPIRE_IS_DICT (*model))
{
- GtkTreeIter parent_iter = *iter;
+ GtkTreeIter parent_iter;
+ if (iter)
+ parent_iter = *iter;
if ( GTK_IS_TREE_MODEL_FILTER (*model))
{
*model = gtk_tree_model_filter_get_model (parent_model);
- gtk_tree_model_filter_convert_iter_to_child_iter (parent_model,
- iter,
- &parent_iter);
+ if (iter)
+ gtk_tree_model_filter_convert_iter_to_child_iter (parent_model,
+ iter,
+ &parent_iter);
}
else if (GTK_IS_TREE_MODEL_SORT (*model))
{
*model = gtk_tree_model_sort_get_model (parent_model);
- gtk_tree_model_sort_convert_iter_to_child_iter (parent_model,
- iter,
- &parent_iter);
+ if (iter)
+ gtk_tree_model_sort_convert_iter_to_child_iter (parent_model,
+ iter,
+ &parent_iter);
}
}
}
struct variable *var;
GtkTreeIter iter;
GtkTreeModel *model;
-
+ PsppireDict *dict;
dv_get_base_model (top_model, top_iter, &model, &iter);
- g_assert (PSPPIRE_IS_DICT (model));
+ dict = PSPPIRE_DICT (model);
gtk_tree_model_get (model,
&iter, DICT_TVM_COL_VAR, &var, -1);
"<span stretch=\"condensed\">%s</span>",
var_get_label (var));
- char *utf8 = pspp_locale_to_utf8 (text, -1, NULL);
+ char *utf8 = recode_string (UTF8, psppire_dict_encoding (dict),
+ text, -1);
g_free (text);
g_object_set (cell, "markup", utf8, NULL);
}
else
{
- char *name = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
+ char *name = recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_name (var), -1);
g_object_set (cell, "text", name, NULL);
g_free (name);
}
struct variable *var = NULL;
gboolean ok;
-
gtk_tree_view_convert_widget_to_bin_window_coords (treeview,
x, y, &bx, &by);
tree_model = gtk_tree_view_get_model (treeview);
-
gtk_tree_view_set_tooltip_row (treeview, tooltip, path);
ok = gtk_tree_model_get_iter (tree_model, &iter, path);
{
gchar *tip ;
+ GtkTreeModel *m;
+ PsppireDict *dict;
+
+ dv_get_base_model (tree_model, NULL, &m, NULL);
+ dict = PSPPIRE_DICT (m);
if ( PSPPIRE_DICT_VIEW (treeview)->prefer_labels )
- tip = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
+ tip = recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_name (var), -1);
else
- tip = pspp_locale_to_utf8 (var_get_label (var), -1, NULL);
+ tip = recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_label (var), -1);
gtk_tooltip_set_text (tooltip, tip);
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (vs));
- vs->val_labs_dialog = val_labs_dialog_create (GTK_WINDOW (toplevel));
+ vs->val_labs_dialog = val_labs_dialog_create (GTK_WINDOW (toplevel),
+ PSPPIRE_SHEET (vs));
vs->missing_val_dialog = missing_val_dialog_create (GTK_WINDOW (toplevel));
vs->var_type_dialog = var_type_dialog_create (GTK_WINDOW (toplevel));
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
-
+#include <libpspp/i18n.h>
#include <gobject/gvaluecollector.h>
static void psppire_var_store_finalize (GObject *object);
-gchar * missing_values_to_string (const struct variable *pv, GError **err);
-
-
static gchar *psppire_var_store_get_string (const PsppireSheetModel *sheet_model, glong row, glong column);
static gboolean psppire_var_store_clear (PsppireSheetModel *model, glong row, glong col);
static glong psppire_var_store_get_row_count (const PsppireSheetModel * model);
static glong psppire_var_store_get_column_count (const PsppireSheetModel * model);
-static gchar *text_for_column (const struct variable *pv, gint c, GError **err);
+static gchar *text_for_column (PsppireVarStore *vs, const struct variable *pv,
+ gint c, GError **err);
static GObjectClass *parent_class = NULL;
}
static gchar *
-psppire_var_store_get_string (const PsppireSheetModel *model, glong row, glong column)
+psppire_var_store_get_string (const PsppireSheetModel *model,
+ glong row, glong column)
{
PsppireVarStore *store = PSPPIRE_VAR_STORE (model);
pv = psppire_dict_get_variable (store->dict, row);
- return text_for_column (pv, column, 0);
+ return text_for_column (store, pv, column, 0);
}
break;
case PSPPIRE_VAR_STORE_COL_LABEL:
{
- gchar *s = utf8_to_pspp_locale (text, -1, NULL);
+ gchar *s = recode_string (psppire_dict_encoding (var_store->dict),
+ UTF8,
+ text, -1);
var_set_label (pv, s);
free (s);
return TRUE;
static const gchar none[] = N_("None");
static gchar *
-text_for_column (const struct variable *pv, gint c, GError **err)
+text_for_column (PsppireVarStore *vs,
+ const struct variable *pv, gint c, GError **err)
{
+ PsppireDict *dict = vs->dict;
static const gchar *const type_label[] =
{
N_("Numeric"),
switch (c)
{
case PSPPIRE_VAR_STORE_COL_NAME:
- return pspp_locale_to_utf8 ( var_get_name (pv), -1, err);
+ return recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_name (pv), -1);
break;
case PSPPIRE_VAR_STORE_COL_TYPE:
{
}
break;
case PSPPIRE_VAR_STORE_COL_LABEL:
- return pspp_locale_to_utf8 (var_get_label (pv), -1, err);
+ return recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_label (pv), -1);
break;
case PSPPIRE_VAR_STORE_COL_MISSING:
{
- return missing_values_to_string (pv, err);
+ return missing_values_to_string (dict, pv, err);
}
break;
case PSPPIRE_VAR_STORE_COL_VALUES:
val_labs_done (&ip);
- ss = pspp_locale_to_utf8 (gstr->str, gstr->len, err);
+ ss = recode_string (UTF8, psppire_dict_encoding (dict),
+ gstr->str, gstr->len);
g_string_free (gstr, TRUE);
return ss;
}
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2005 Free Software Foundation
+ Copyright (C) 2005, 2009 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "val-labs-dialog.h"
#include <data/value-labels.h>
#include <data/format.h>
-
+#include "psppire-var-sheet.h"
+#include "psppire-var-store.h"
+#include <libpspp/i18n.h>
struct val_labs_dialog
{
GtkWidget *window;
+ PsppireSheet *vs;
+
/* The variable to be updated */
struct variable *pv;
/* Callback which occurs when a line item is selected in the list of
value--label pairs.*/
static void
-on_select_row (GtkTreeView *treeview,
- gpointer data)
+on_select_row (GtkTreeView *treeview, gpointer data)
{
gchar *labeltext;
struct val_labs_dialog *dialog = data;
gchar *const text = value_to_text (vl->value,
*var_get_write_format (dialog->pv));
+ PsppireVarStore *var_store =
+ PSPPIRE_VAR_STORE (psppire_sheet_get_model (dialog->vs));
+
g_signal_handler_block (GTK_ENTRY (dialog->value_entry),
dialog->value_handler_id);
g_signal_handler_block (GTK_ENTRY (dialog->label_entry),
dialog->change_handler_id);
- labeltext = pspp_locale_to_utf8 (vl->label, -1, 0);
+
+ labeltext = recode_string (UTF8, psppire_dict_encoding (var_store->dict),
+ vl->label, -1);
+
gtk_entry_set_text (GTK_ENTRY (dialog->label_entry),
labeltext);
g_free (labeltext);
/* Create a new dialog box
(there should normally be only one)*/
struct val_labs_dialog *
-val_labs_dialog_create (GtkWindow *toplevel)
+val_labs_dialog_create (GtkWindow *toplevel, PsppireSheet *sheet)
{
GtkTreeViewColumn *column;
dialog->window = get_widget_assert (xml,"val_labs_dialog");
dialog->value_entry = get_widget_assert (xml,"value_entry");
dialog->label_entry = get_widget_assert (xml,"label_entry");
+ dialog->vs = sheet;
gtk_window_set_transient_for
(GTK_WINDOW (dialog->window), toplevel);
GtkTreeIter iter;
+ PsppireVarStore *var_store =
+ PSPPIRE_VAR_STORE (psppire_sheet_get_model (dialog->vs));
+
GtkListStore *list_store = gtk_list_store_new (2,
G_TYPE_STRING,
G_TYPE_DOUBLE);
*var_get_write_format (dialog->pv));
gchar *labeltext =
- pspp_locale_to_utf8 (vl->label, -1, 0);
+ recode_string (UTF8,
+ psppire_dict_encoding (var_store->dict),
+ vl->label, -1);
gchar *const text = g_strdup_printf ("%s = \"%s\"",
- vstr, labeltext);
-
+ vstr, labeltext);
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
#ifndef __PSPPIRE_VAL_LABS_DIALOG_H
#define __PSPPIRE_VAL_LABS_DIALOG_H
#include <gtk/gtk.h>
#include <data/variable.h>
+#include <gtk-contrib/psppire-sheet.h>
struct val_labs;
-struct val_labs_dialog * val_labs_dialog_create (GtkWindow *);
+struct val_labs_dialog * val_labs_dialog_create (GtkWindow *, PsppireSheet *);
void val_labs_dialog_show (struct val_labs_dialog *);
#include <data/variable.h>
#include <data/format.h>
#include <stdlib.h>
+#include "psppire-dict.h"
#include <gettext.h>
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
#include "helper.h"
+#include <libpspp/i18n.h>
static const gchar none[] = N_("None");
-gchar *
-name_to_string (const struct variable *var, GError **err)
-{
- const char *name = var_get_name (var);
- g_assert (name);
-
- return pspp_locale_to_utf8 (name, -1, err);
-}
-
-
-gchar *
-label_to_string (const struct variable *var, GError **err)
-{
- const char *label = var_get_label (var);
-
- if ( ! label ) return g_strdup (none);
-
- return pspp_locale_to_utf8 (label, -1, err);
-}
gchar *
measure_to_string (const struct variable *var, GError **err)
gchar *
-missing_values_to_string (const struct variable *pv, GError **err)
+missing_values_to_string (const PsppireDict *dict, const struct variable *pv, GError **err)
{
const struct fmt_spec *fmt = var_get_print_format (pv);
gchar *s;
g_string_append (gstr, mv[i]);
g_free (mv[i]);
}
- s = pspp_locale_to_utf8 (gstr->str, gstr->len, err);
+ s = recode_string (UTF8, psppire_dict_encoding (dict),
+ gstr->str, gstr->len);
g_string_free (gstr, TRUE);
}
else
g_string_append (gstr, ss);
free (ss);
}
- s = pspp_locale_to_utf8 (gstr->str, gstr->len, err);
+ s = recode_string (UTF8, psppire_dict_encoding (dict),
+ gstr->str, gstr->len);
g_string_free (gstr, TRUE);
}
#include <glib.h>
#include <data/variable.h>
+#include "psppire-dict.h"
struct variable;
#define n_ALIGNMENTS 3
extern const gchar *const alignments[n_ALIGNMENTS + 1];
-
extern const gchar *const measures[n_MEASURES + 1];
-
-gchar * name_to_string (const struct variable *var, GError **err);
-
-
-gchar * missing_values_to_string (const struct variable *pv, GError **err);
-
-gchar * measure_to_string (const struct variable *var, GError **err);
-
-gchar * label_to_string (const struct variable *var, GError **err);
-
+gchar *missing_values_to_string (const PsppireDict *dict, const struct variable *pv, GError **err);
+gchar *measure_to_string (const struct variable *var, GError **err);
#endif
#include "helper.h"
#include <language/syntax-string-source.h>
+#include <libpspp/i18n.h>
#include "helper.h"
#define N_(msgid) msgid
+static const gchar none[] = N_("None");
+
+
+static gchar *
+name_to_string (const struct variable *var, PsppireDict *dict)
+{
+ const char *name = var_get_name (var);
+ g_assert (name);
+
+ return recode_string (UTF8, psppire_dict_encoding (dict),
+ name, -1);
+}
+
+
+static gchar *
+label_to_string (const struct variable *var, PsppireDict *dict)
+{
+ const char *label = var_get_label (var);
+
+ if (! label) return g_strdup (none);
+
+ return recode_string (UTF8, psppire_dict_encoding (dict),
+ label, -1);
+}
+
static void
populate_text (PsppireDictView *treeview, gpointer data)
{
gchar *text = 0;
GString *gstring;
+ PsppireDict *dict;
GtkTextBuffer *textbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(data));
const struct variable *var =
if ( var == NULL)
return;
+ g_object_get (treeview,
+ "dictionary", &dict,
+ NULL);
+
gstring = g_string_sized_new (200);
text = name_to_string (var, NULL);
g_string_assign (gstring, text);
g_string_append_printf (gstring, _("Type: %s\n"), buffer);
}
- text = missing_values_to_string (var, NULL);
+ text = missing_values_to_string (dict, var, NULL);
g_string_append_printf (gstring, _("Missing Values: %s\n"),
text);
g_free (text);
g_string_append (gstring, "\n");
g_string_append (gstring, _("Value Labels:\n"));
-#if 1
for (vl = val_labs_first_sorted (labs, &vli);
vl;
vl = val_labs_next (labs, &vli))
gchar *const vstr =
value_to_text (vl->value, *var_get_print_format (var));
- text = pspp_locale_to_utf8 (vl->label, -1, NULL);
+
+ text = recode_string (UTF8, psppire_dict_encoding (dict),
+ vl->label, -1);
g_string_append_printf (gstring, _("%s %s\n"), vstr, text);
g_free (text);
g_free (vstr);
}
-#endif
}
gtk_text_buffer_set_text (textbuffer, gstring->str, gstring->len);