Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-16038

Engines should use same encoding for CSV header and data.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2.0
    • Component/s: eclrtl
    • Labels:
      None

      Description

      Hi,

      We have a requirement to output a CSV from THOR using 'Ý' as a separator,
      Capital Y with Acute. Unfortunately I am unable to use this separator for the column headers, but works ok for every other row in the csv.

      Any ideas, or is this a bug, or new feature?

      The following BWR illustrates my approach to get UPPERCASE headers and custom separator.

      Related JIRA > https://track.hpccsystems.com/browse/HPCC-15485

      ..............

      myRec := record
      string4 f1;
      integer1 f2;
      string1 f3;
      end;

      writeCSV(_ds, _filename, _sep) := functionmacro
      // KLUDGE to output uppercase headers, and use specific separator
      output(dataset([],recordof(_ds)),,_filename+'_headers',overwrite,csv(heading(SINGLE),separator(_sep),quote('"'),terminator('\r\n'),UNICODE));
      headerRow := dataset(_filename+'_headers',

      {String line}

      ,csv(heading(0),separator('|'),quote('"'),terminator('\r\n'),UNICODE));

      // use UPPER case headers as headertext and write out UTF-8/16 CSV
      return output(_ds,,_filename,overwrite,csv(heading(STD.STR.ToUpperCase(headerRow[1].line),single),separator(_sep),quote('"'),terminator('\r\n'),UNICODE));
      endmacro;

      ds := dataset(
      [

      {'aaaa',1,'A'}

      ,

      {'bbbb',2,'B'}

      ,

      {'cccc',3,'C'}

      ],
      myRec
      );

      writeCSV(ds, '~afarrell::20160803::csvtest',U'Ý');

      ..............

      As mentioned on forum > https://hpccsystems.com/bb/viewtopic.php?f=8&t=2543&p=10383#p10383

        Attachments

          Activity

            People

            • Assignee:
              ghalliday Gavin Halliday
              Reporter:
              andrewfarrell Andrew Farrell
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: