| Ticket UUID: | 1724818 | |||
| Title: | csv::join doesn't properly handle embedded newlines | |||
| Type: | Bug | Version: | None | |
| Submitter: | nobody | Created on: | 2007-05-24 12:55:44 | |
| Subsystem: | csv | Assigned To: | andreas_kupries | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2011-11-23 09:22:47 | |
| Resolution: | Fixed | Closed By: | andreas_kupries | |
| Closed on: | 2011-11-23 02:22:47 | |||
| Description: |
csv::join doesn't properly handle the case where a value contains an embedded newline or carriage return.
Corrected code is below (note the change in [string match])
proc ::csv::join {values {sepChar ,}} {
set out ""
set sep {}
foreach val $values {
if {[string match "*\[\r\n\"$sepChar\]*" $val]} {
append out $sep\"[string map [list \" \"\"] $val]\"
} else {
append out $sep$val
}
set sep $sepChar
}
return $out
}
Tim
| |||
| User Comments: |
andreas_kupries added on 2011-11-23 09:22:47:
allow_comments - 1 Fix committed to CVS head. Finally. | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki