i18n: Introduce C_ENCODING as replacement for LEGACY_NATIVE.
[pspp-builds.git] / src / language / data-io / print.c
index cfbe04396191e5b1f7098f0b7df40ce6fac29edf..a07ca2d8c54baa3f65b54aa9eeb60c005a7e6f01 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
 
    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
@@ -200,7 +200,7 @@ internal_cmd_print (struct lexer *lexer, struct dataset *ds,
       trns->encoding = dfm_writer_get_legacy_encoding (trns->writer);
     }
   else
-    trns->encoding = LEGACY_NATIVE;
+    trns->encoding = UTF8;
 
   /* Output the variable table if requested. */
   if (print_table)
@@ -280,7 +280,7 @@ parse_string_argument (struct lexer *lexer, struct print_trns *trns, int record,
   spec->type = PRT_LITERAL;
   spec->record = record;
   spec->first_column = *column;
-  ds_init_string (&spec->string, lex_tokstr (lexer));
+  ds_init_substring (&spec->string, lex_tokss (lexer));
   ds_register_pool (&spec->string, trns->pool);
   lex_get (lexer);
 
@@ -454,7 +454,7 @@ print_trns_proc (void *trns_, struct ccase **c, casenumber case_num UNUSED)
 {
   struct print_trns *trns = trns_;
   bool eject = trns->eject;
-  char encoded_space = legacy_from_native (trns->encoding, ' ');
+  char encoded_space = recode_byte (trns->encoding, C_ENCODING, ' ');
   int record = 1;
   struct prt_out_spec *spec;
 
@@ -479,11 +479,11 @@ print_trns_proc (void *trns_, struct ccase **c, casenumber case_num UNUSED)
       else
         {
           ds_put_substring (&trns->line, ds_ss (&spec->string));
-          if (0 != strcmp (trns->encoding, LEGACY_NATIVE))
+          if (0 != strcmp (trns->encoding, C_ENCODING))
             {
               size_t length = ds_length (&spec->string);
               char *data = ss_data (ds_tail (&trns->line, length));
-             char *s = recode_string (trns->encoding, LEGACY_NATIVE, data, length);
+             char *s = recode_string (trns->encoding, C_ENCODING, data, length);
              memcpy (data, s, length);
              free (s);
             }
@@ -518,7 +518,7 @@ flush_records (struct print_trns *trns, int target_record,
           else
             leader = '1';
         }
-      line[0] = legacy_from_native (trns->encoding, leader);
+      line[0] = recode_byte (trns->encoding, C_ENCODING, leader);
 
       if (trns->writer == NULL)
         tab_output_text (TAB_FIX, &line[1]);