bugPSPP - Bugs: bug #40223, save translate type=csv ignores...

 
 

bug #40223: save translate type=csv ignores crlf settings

Submitted by:  None
Submitted on:  Wed 09 Oct 2013 06:25:29 PM UTC  
 
Category:  Output Driver Severity:  5 - Average
Status:  Fixed Assigned to:  None
Open/Closed:  Closed Release:  None
Effort:  0.00

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 02 Sep 2020 04:44:34 AM UTC, comment #1: 

It's hard to understand how this could be happening. The stream used to write to CSV files is opened via fdopen(), which should interpret the mode string properly to make the stream a text or binary stream.  However, the code in question wasn't passing O_BINARY or O_TEXT properly to the preceding open() call.  I don't think that's supposed to matter, but maybe it does in practice. Anyhow, if that's the problem, I've now fixed it, via commit 4f36eb1c4b91 ("make-file: Pass O_BINARY or O_TEXT to open() call in replace_file_start().").

Ben Pfaff <blp>
Project Administrator
Wed 09 Oct 2013 06:25:29 PM UTC, original submission:  

Bug:
SAVE TRANSLATE /TYPE=CSV always output LF as line end

Expected:
It must be FILE HANDLE /ENDS={value} or CRLF on Windows by default

Suggested fix:

Instead of putc('\n');
in  csv-file-writer.c / csv_write_case()
and csv-file-writer.c / write_var_names()

must be same logic as in
  data-writer.c/dfm_put_record()
     case FH_MODE_TEXT:

something like:
  if (w->opts->line_ends == FH_END_CRLF)...

Of course, w->opts must have line_ends initialized in csv_writer_options_init().

Workaround:

Use WRITE instead of SAVE TRANSLATED until problem fixed. WRITE works as expected.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by blp (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-09-02 blp StatusNone => Fixed
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.5