andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.77k stars 201 forks source link

Failed to open csv with some double quotes #825

Closed amalgame21 closed 1 year ago

amalgame21 commented 1 year ago

addresses.csv

John,Doe,120 jefferson st.,Riverside, NJ, 08075
Jack,McGinnis,220 hobo Av.,Phila, PA,09119
"John ""Da Man""",Repici,120 Jefferson St.,Riverside, NJ,08075
Stephen,Tyler,"7452 Terrace ""At the Plaza"" road",SomeTown,SD, 91234
,Blankman,,SomeTown, SD, 00298
"Joan ""the bone"", Anne",Jet,"9th, at Terrace plc",Desert City,CO,00123

error: syntax error: label A2="John ""Da Man""" syntax error: label C3="7452 Terrace ""At the Plaza"" road" syntax error: label A5="Joan ""the bone"" syntax error: label A5=" Anne""

Installed with AUR sc-im-git package:

sc-im - version 0.8.4
-DNCURSES
-DMAXROWS 65536
-DUNDO
-DXLSX
-DXLUA
-DDEFAULT_COPY_TO_CLIPBOARD_CMD="xclip -i -selection clipboard <"
-DDEFAULT_PASTE_FROM_CLIPBOARD_CMD="xclip -o -selection clipboard"
-DDEFAULT_OPEN_FILE_UNDER_CURSOR_CMD="scopen"
-DUSELOCALE
-DMOUSE
-DUSECOLORS
-D_XOPEN_SOURCE_EXTENDED
-D_GNU_SOURCE
-DSNAME="sc-im"
-DHELP_PATH="/usr/share/sc-im"
-DLIBDIR="/usr/share/doc/sc-im"
-DDFLT_PAGER="less"
-DDFLT_EDITOR="vim"
-DCONFIG_DIR=".config/sc-im"
-DCONFIG_FILE="scimrc"
-DHISTORY_DIR=".cache"
-DHISTORY_FILE="sc-iminfo"
-DINS_HISTORY_FILE="sc-iminfo"
-DHAVE_PTHREAD
-DAUTOBACKUP
andmarti1424 commented 1 year ago

@amalgame21 yes. i am afraid some special cases with quotes get out of scope and fail to import correctly. we should use a proper csv parsing library for csv import. but im afraid i cannot find any in C.if you can find any, please let me know. in the particular case of your file, its not as easy as replace "" with \"\", cause as you would see, it still fails with the "Joan ""the bone"", Anne",Jet record. thanks!

amalgame21 commented 1 year ago

Thanks for your reply!

andmarti1424 commented 1 year ago

wont fix the special case. waiting to find a proper csv library for C.