Question
Why does one double quotation automatically become two double quotations when using the CSV File Connector to output data containing double quotations?
Answer
This behavior is a specification of the CSV File Connector.
When outputting data containing a double quotation, it outputs two consecutive double quotations like "". (This is called "escaping" to add another double quotation to a double quotation)
This process is known as "escaping," where another double quotation is added to a double quotation to ensure compliance with the official CSV specification (RFC). You can find more information about CSV formatting in the RFC document here.
If you need to handle double quotations differently in the output, you have a couple of workarounds:
Workarounds
-To exclude double quotations from the output
You can use string replacement logics, such as Replace Each String, to replace double quotations with blank characters.
-To output double quotations as they are
You can utilize the Variable Length Connector to output double quotations without escaping them. For more information on how to achieve this, please refer to the Write Variable-Length File feature.
Reference Information
About escaping double quotations
http://www.ietf.org/rfc/rfc4180.txt
The following description is found in "2. Definition of the CSV Format" on the above site.
7. If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote.
String Replacement Logics
Replace Each String
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Mapper/Convert.htm
Replace by CSV Table
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Mapper/ConvertByFile.htm
Replace by DB Table
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Mapper/ConvertByDB.htm
About Variable Length Connector
Write Variable-Length File
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Connector/variablelength_put_data.htm
Variable-Length Write Wizard
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Connector/variable_put_wizard.htm
Comments
0 comments
Article is closed for comments.