Welcome, Guest. Please Login
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
Pages: 1
Send Topic Print
Escaping straight double quotes for CSV export (Read 3916 times)
Mark Anderson
YaBB Administrator

User - not staff!

Posts: 5689
Southsea, UK
Escaping straight double quotes for CSV export
Jul 4th, 2012, 10:18am
Some apps that consume CSV (comma separated variable) delimited data require that some/all field (attribute) values are enclosed is straight double quotes.  If that character occurs within a value, it must be escaped by doubling it. Thus a $Text of:

He shouted "Hello!" at the top of his voice.

must be exported as:

"He shouted ""Hello!"" at the top of his voice."

This can be done with String.replace('"','""'), noting that single straight quotes need to be used as the pattern delimiter for the find & replace patterns in the TB code. Note there is no need to escape typographic double quotes, i.e. 'smart' or 'curly\ quotes, just the straight ones.

More here.
Back to top
« Last Edit: Jul 04th, 2012, 10:23am by Mark Anderson »  

Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print