AutoHotkey Community

It is currently May 26th, 2012, 8:33 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: August 3rd, 2005, 6:07 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
There is something inconsistent with handling quoted commas.
Code:
L1 = a,"a,b"
Loop Parse, L1, CSV
   MsgBox %A_LoopField%
L2 = a, "a,b"
Loop Parse, L2, CSV
   MsgBox %A_LoopField%
L3 = a, a "," b
Loop Parse, L3, CSV
   MsgBox %A_LoopField%
L1 is parsed to [a] and [a,b], which is right.
L2 is parsed to [a] and [''a] and [b"], just because of the space in front of "a..., the quotes become normal characters.
L3 is parsed to [a] and [a "] and [b], quite unexpected. One quote becomes normal character, the second one disappears. I’d like to see [a] and [a "," b].


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 3rd, 2005, 12:54 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I see what you mean. However, I don't think the examples you gave are proper CSV format (to the extent that there is such a thing). I think the biggest problem is the space after the comma: I'm pretty sure that is invalid in all CSV formats unless it's to be part of the literal text in that field.

The program was written to parse CSV files from Excel. Of course Excel isn't the only source of CSV files, but I'd hoped the design would handle the most common formats.

Even if it turns out that this should be fixed -- which I'm in doubt about but will gladly discuss further -- doing so would likely break existing scripts that rely on the current behavior.

Thanks for reporting it.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group