Forum Stats

  • 3,853,509 Users
  • 2,264,229 Discussions


Spool csv file format utf-8 vs ansi for excel

StuartH Member Posts: 21 Red Ribbon
edited Aug 27, 2019 1:54AM in SQLcl

I have a spool formatting problem after moving from sqlcl version 4.2 on Windows 7 to 18.1 on Windows 10

In our database we use the character "¬" (unicode 172) as a separator for a particular set of data.  But this character doesn't format correctly in excel after the spool.

I still have access to both machines; and from testing between the two, I'm finding that the spool defaults to UTF-8, but when the "¬" is found is changes to ANSI.

But on my new machine it just always outputs to UTF-8, which is causing formatting problems when opened in excel.

I'm a bit stuck as to what to do about this?  Any guidence would be appriecated




  • cormaco
    cormaco Member Posts: 1,989 Silver Crown
    edited Aug 27, 2019 1:54AM

    You could try using SQL*Plus instead, starting with version 12.2. it has the option SET MARKUP CSV and the output is using the codepage of the CMD window.

    I usually set my CMD codepage via CHCP 1252 before launching SQL*Plus and the spool file can then be correctly openend by Excel.

    Depending on your Windows language you might need another codepage.