The way you are using OPEN and READ is intended to read one line of a text file. They are not made especially for CSV files. And while CSV files may have a line-feed-character inside a line (when encapsulated in double-quotes), a line of a normal text file simply ends with a line-feed.
So I think you have two options here: Read the file byte by byte as a binary file or load the whole file to the debuggers virtual memory (VM) and read it from there byte by byte.
Option 1 : Read the file byte by byte
OPEN #1 "&csv_name" /Read /Binary
WHILE !FILE.EOF(1)
(
PRIVATE &line
GOSUB getline "1"
RETURNVALUES &line
IF "&line"!=""
ECHO "&line"
)
CLOSE #1
ENDDO
getline:
PARAMETERS &fh
PRIVATE &c &last &line &inquotes
&last=0
&inquotes=FALSE()
READ #&fh &c
WHILE !FILE.EOF(&fh)
(
IF (&last=='"')&&(&c!='"')
&inquotes=!&inquotes
IF (!&inquotes)&&(&c==CONvert.CHAR(0x0A))
(
IF &last==CONvert.CHAR(0x0D)
&line=STRing.CUT("&line",-1)
RETURN "&line"
)
&line="&line"+CONvert.CHAR(&c)
&last=&c
READ #&fh &c
)
RETURN "&line"
Option 2 : Load the whole file to the debuggers virtual memory (VM) and read it from there byte by byte.
PRIVATEn &line &size &pos
&pos=0
&size=OS.FILE.SIZE("&csv_name")
SILENT.Data.LOAD.Binary "&csv_name" VM:&pos
WHILE &pos<&size
(
GOSUB getline "1" "&pos" "&size"
RETURNVALUES &line &pos
IF "&line"!=""
ECHO "&line"
)
CLOSE #1
ENDDO
getline:
PARAMETERS &fh &pos &size
PRIVATE &c &last &line &inquotes
&last=0
&inquotes=FALSE()
WHILE &pos<&size
(
&c=Data.Byte(VM:&pos)
&pos=&pos+1
IF (&last=='"')&&(&c!='"')
&inquotes=!&inquotes
IF (!&inquotes)&&(&c==CONvert.CHAR(0x0A))
(
IF &last==CONvert.CHAR(0x0D)
&line=STRing.CUT("&line",-1)
RETURN "&line" "&pos"
)
&line="&line"+CONvert.CHAR(&c)
&last=&c
)
RETURN "&line" "&pos"