Dyadic CSV

General APL language issues

Dyadic CSV

Postby crishog on Thu Feb 22, 2018 1:16 pm

About the second element of the right argument to a dyadic ⎕CSV call the documentation says:

a character vector specifying the file encoding such as 'UTF-8' (see File Encodings). This applies when Y[1] is a file name or tie number. If omitted or empty, the file encoding defaults to 'UTF-8'.

But If I put the following (where dest is a file name)

data ⎕csv dest ''

I get

DOMAIN ERROR: Invalid file encoding type
data ⎕CSV dest''
crishog
 
Posts: 61
Joined: Mon Jan 25, 2010 9:52 am

Re: Dyadic CSV

Postby crishog on Thu Feb 22, 2018 2:35 pm

The documentation also says:

If Y specifies that the CSV data is written to a file then R is the number of bytes (not characters) written

But I get zero every time, even though the data is correct appended to the CSV output file
crishog
 
Posts: 61
Joined: Mon Jan 25, 2010 9:52 am

Re: Dyadic CSV

Postby Richard|Dyalog on Fri Feb 23, 2018 11:31 am

Hi, Chris -

The first problem you report is a documentation error. The documentation says that specifying an encoding of '' is equivalent to specifying 'UTF-8', but I don't know why; that was not in the original design specification from which the implementation and documentation was derived. I have raised a bug report on the documentation - but, in fact, it might be a nice enhancement so may update the implementation instead.

Note that you can completely omit the encoding specification, in which case it does default to 'UTF-8'

The second problem you report is a bug in the implementation which I have raised and fixed. When you write to a native file the return value is supposed to be the number of bytes written, and it is supposed to be shy; in practice it was always returning non-shy 0.

I can confirm that although the returned byte count was incorrect, the data was being written correctly and the file position was correctly updated.

If you need to contact support regarding these bug reports the reference numbers are 15517 (documentation) and 15519 (return value).
User avatar
Richard|Dyalog
 
Posts: 44
Joined: Thu Oct 02, 2008 11:11 am

Re: Dyadic CSV

Postby crishog on Fri Feb 23, 2018 11:47 am

Ta.

I thought I was doing something daft.
crishog
 
Posts: 61
Joined: Mon Jan 25, 2010 9:52 am


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest