dictionary: Make dict_create() take the new dictionary's encoding.
[pspp-builds.git] / src / ui / gui / text-data-import-dialog.c
index 298fd18d95cec244e4f3edf6c0791a52124b987f..8579ccc94958abcbe8d3aac33800c8eca1de96f4 100644 (file)
@@ -32,6 +32,7 @@
 #include "language/data-io/data-parser.h"
 #include "language/lexer/lexer.h"
 #include "libpspp/assertion.h"
+#include "libpspp/i18n.h"
 #include "libpspp/message.h"
 #include "ui/gui/checkbox-treeview.h"
 #include "ui/gui/descriptives-dialog.h"
@@ -329,7 +330,7 @@ apply_dict (const struct dictionary *dict, struct string *s)
               ds_put_cstr (s, "\n  ");
               syntax_gen_value (s, &vl->value, width, format);
               ds_put_byte (s, ' ');
-              syntax_gen_string (s, ss_cstr (val_lab_get_label (vl)));
+              syntax_gen_string (s, ss_cstr (val_lab_get_escaped_label (vl)));
             }
           free (labels);
           ds_put_cstr (s, ".\n");
@@ -475,8 +476,8 @@ init_file (struct import_assistant *ia, GtkWindow *parent_window)
           destroy_file (ia);
           return false;
         }
-      ds_chomp (line, '\n');
-      ds_chomp (line, '\r');
+      ds_chomp_byte (line, '\n');
+      ds_chomp_byte (line, '\r');
     }
 
   if (file->line_cnt == 0)
@@ -1251,7 +1252,7 @@ choose_column_names (struct import_assistant *ia)
   struct column *col;
   size_t name_row;
 
-  dict = dict_create ();
+  dict = dict_create (get_default_encoding ());
   name_row = f->variable_names && f->skip_lines ? f->skip_lines : 0;
   for (col = s->columns; col < &s->columns[s->column_cnt]; col++)
     {
@@ -1594,7 +1595,7 @@ prepare_formats_page (struct import_assistant *ia)
 
   push_watch_cursor (ia);
 
-  dict = dict_create ();
+  dict = dict_create (get_default_encoding ());
   fg = fmt_guesser_create ();
   for (column_idx = 0; column_idx < s->column_cnt; column_idx++)
     {
@@ -1768,8 +1769,7 @@ parse_field (struct import_assistant *ia,
     {
       char *error;
 
-      error = data_in (field, LEGACY_NATIVE, in->type, &val,
-                       var_get_width (var),
+      error = data_in (field, C_ENCODING, in->type, &val, var_get_width (var),
                        dict_get_encoding (ia->formats.dict));
       if (error != NULL)
         {