[ 
https://issues.apache.org/jira/browse/CAMEL-12274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16432726#comment-16432726
 ] 

ASF GitHub Bot commented on CAMEL-12274:
----------------------------------------

davsclaus closed pull request #2287: CAMEL-12274: Bindy - Unescape double 
quotes inside CSV field
URL: https://github.com/apache/camel/pull/2287
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 00e6af09cfd..8bd5b197e90 100644
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -51,6 +51,7 @@
 public class BindyCsvFactory extends BindyAbstractFactory implements 
BindyFactory {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(BindyCsvFactory.class);
+    private static final String DOUBLE_QUOTES_SYMBOL = "\"";
 
     boolean isOneToMany;
 
@@ -95,7 +96,7 @@ public void initCsvModel() throws Exception {
         // Find annotated Datafields declared in the Model classes
         initAnnotatedFields();
 
-        // initialize Csv parameter(s)
+        // initialize CSV parameter(s)
         // separator and skip first line from @CSVrecord annotation
         initCsvRecordParameters();
     }
@@ -242,6 +243,10 @@ private int setDataFieldValue(CamelContext camelContext, 
Map<String, Object> mod
             try {
                 if (quoting && quote != null && (data.contains("\\" + quote) 
|| data.contains(quote)) && quotingEscaped) {
                     value = format.parse(data.replaceAll("\\\\" + quote, "\\" 
+ quote));
+                } else if (quote != null && quote.equals(DOUBLE_QUOTES_SYMBOL) 
&& data.contains(DOUBLE_QUOTES_SYMBOL + DOUBLE_QUOTES_SYMBOL) && 
!quotingEscaped) {
+                    // If double-quotes are used to enclose fields, the two 
double 
+                    // quotes character must be replaced with one according to 
RFC 4180 section 2.7
+                    value = format.parse(data.replaceAll(DOUBLE_QUOTES_SYMBOL 
+ DOUBLE_QUOTES_SYMBOL, DOUBLE_QUOTES_SYMBOL));
                 } else {
                     value = format.parse(data);
                 }
@@ -359,9 +364,14 @@ public String unbind(CamelContext camelContext, 
Map<String, Object> model) throw
                         if (quoting && quote != null) {
                             buffer.append(quote);
                         }
-                        // CAMEL-7519 - improvoment escape the token itself by 
prepending escape char
+                        // CAMEL-7519 - improvement escape the token itself by 
prepending escape char
                         if (quoting && quote != null && (res.contains("\\" + 
quote) || res.contains(quote))  && quotingEscaped) {
                             buffer.append(res.replaceAll("\\" + quote, "\\\\" 
+ quote));
+                        } else if (quoting && quote != null && 
quote.equals(DOUBLE_QUOTES_SYMBOL) && res.contains(quote) && !quotingEscaped) {
+                            // 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 according to RFC 4180 section 2.7
+                            buffer.append(res.replaceAll(DOUBLE_QUOTES_SYMBOL, 
DOUBLE_QUOTES_SYMBOL + DOUBLE_QUOTES_SYMBOL));
                         } else {
                             buffer.append(res);
                         }
diff --git 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesInFieldCsvUnmarshallTest.java
 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesInFieldCsvUnmarshallTest.java
new file mode 100644
index 00000000000..deb5fbeb1ca
--- /dev/null
+++ 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesInFieldCsvUnmarshallTest.java
@@ -0,0 +1,205 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.csv;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
+import org.apache.camel.dataformat.bindy.annotation.DataField;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import 
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+@ContextConfiguration
+public class BindyDoubleQuotesInFieldCsvUnmarshallTest extends 
AbstractJUnit4SpringContextTests {
+
+    private static final String URI_MOCK_RESULT = "mock:result";
+    private static final String URI_DIRECT_START = "direct:start";
+
+    @Produce(uri = URI_DIRECT_START)
+    private ProducerTemplate template;
+
+    @EndpointInject(uri = URI_MOCK_RESULT)
+    private MockEndpoint result;
+
+    private String expected;
+
+    @Test
+    @DirtiesContext
+    public void testUnMarshallMessage() throws Exception {
+
+        expected = "\"10\",\"A9\",\"Pauline de 
\"\"Quotes\"\"\",\"M\",\"ISIN\",\"XD12345678\",\"BUY\",\"Share\",\"2500.45\",\"USD\",\"08-01-2009\"";
+
+        template.sendBody(expected);
+
+        result.expectedMessageCount(1);
+        result.assertIsSatisfied();
+        
+        Order order = 
result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
+        Assert.assertEquals("Pauline de \"Quotes\"", order.getFirstName());
+    }
+
+    public static class ContextConfig extends RouteBuilder {
+        BindyCsvDataFormat camelDataFormat = new 
BindyCsvDataFormat(Order.class);
+
+        public void configure() {
+            
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
+        }
+
+    }
+    
+    @CsvRecord(separator = ",")
+    public static class Order {
+
+        @DataField(pos = 1)
+        private int orderNr;
+
+        @DataField(pos = 2)
+        private String clientNr;
+
+        @DataField(pos = 3)
+        private String firstName;
+
+        @DataField(pos = 4)
+        private String lastName;
+
+        @DataField(pos = 5)
+        private String instrumentCode;
+
+        @DataField(pos = 6)
+        private String instrumentNumber;
+
+        @DataField(pos = 7)
+        private String orderType;
+
+        @DataField(name = "Name", pos = 8)
+        private String instrumentType;
+
+        @DataField(pos = 9, precision = 2)
+        private BigDecimal amount;
+
+        @DataField(pos = 10)
+        private String currency;
+
+        @DataField(pos = 11, pattern = "dd-MM-yyyy")
+        private Date orderDate;
+
+        public int getOrderNr() {
+            return orderNr;
+        }
+
+        public void setOrderNr(int orderNr) {
+            this.orderNr = orderNr;
+        }
+
+        public String getClientNr() {
+            return clientNr;
+        }
+
+        public void setClientNr(String clientNr) {
+            this.clientNr = clientNr;
+        }
+
+        public String getFirstName() {
+            return firstName;
+        }
+
+        public void setFirstName(String firstName) {
+            this.firstName = firstName;
+        }
+
+        public String getLastName() {
+            return lastName;
+        }
+
+        public void setLastName(String lastName) {
+            this.lastName = lastName;
+        }
+
+        public String getInstrumentCode() {
+            return instrumentCode;
+        }
+
+        public void setInstrumentCode(String instrumentCode) {
+            this.instrumentCode = instrumentCode;
+        }
+
+        public String getInstrumentNumber() {
+            return instrumentNumber;
+        }
+
+        public void setInstrumentNumber(String instrumentNumber) {
+            this.instrumentNumber = instrumentNumber;
+        }
+
+        public String getOrderType() {
+            return orderType;
+        }
+
+        public void setOrderType(String orderType) {
+            this.orderType = orderType;
+        }
+
+        public String getInstrumentType() {
+            return instrumentType;
+        }
+
+        public void setInstrumentType(String instrumentType) {
+            this.instrumentType = instrumentType;
+        }
+
+        public BigDecimal getAmount() {
+            return amount;
+        }
+
+        public void setAmount(BigDecimal amount) {
+            this.amount = amount;
+        }
+
+        public String getCurrency() {
+            return currency;
+        }
+
+        public void setCurrency(String currency) {
+            this.currency = currency;
+        }
+
+        public Date getOrderDate() {
+            return orderDate;
+        }
+
+        public void setOrderDate(Date orderDate) {
+            this.orderDate = orderDate;
+        }
+
+        @Override
+        public String toString() {
+            return "Model : " + Order.class.getName() + " : " + this.orderNr + 
", " + this.orderType + ", " + String.valueOf(this.amount) + ", " + 
this.instrumentCode + ", "
+                   + this.instrumentNumber + ", " + this.instrumentType + ", " 
+ this.currency + ", " + this.clientNr + ", " + this.firstName + ", " + 
this.lastName + ", "
+                   + String.valueOf(this.orderDate);
+        }
+    }
+
+}
diff --git 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeFalseTest.java
 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeFalseTest.java
index 1e7f99199dd..0e9b4a35546 100644
--- 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeFalseTest.java
+++ 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeFalseTest.java
@@ -51,7 +51,7 @@ public void 
testMarshallCsvRecordFieldContainingMultiEscapedQuoteChar() throws E
 
         BindyCsvRowFormat75191 body = new BindyCsvRowFormat75191();
         body.setFirstField("123");
-        body.setSecondField("\"\"foo\"\"");
+        body.setSecondField("\"foo\"");
         body.setNumber(new BigDecimal(10));
         template.sendBody("direct:startMarshal1", body);
         
@@ -60,7 +60,7 @@ public void 
testMarshallCsvRecordFieldContainingMultiEscapedQuoteChar() throws E
         BindyCsvRowFormat75191 model = 
mockEndPointUnMarshal1.getReceivedExchanges().get(0).getIn().getBody(BindyCsvRowFormat75191.class);
         
         assertEquals("123", model.getFirstField());
-        assertEquals("\"\"foo\"\"", model.getSecondField());
+        assertEquals("\"foo\"", model.getSecondField());
         assertEquals(new BigDecimal(10), model.getNumber());
     }
     
@@ -120,6 +120,7 @@ public void configure() throws Exception {
     //from https://issues.apache.org/jira/browse/CAMEL-7519
     @CsvRecord(separator = ",", quote = "\"", quoting = true, quotingEscaped = 
false)
     public static class BindyCsvRowFormat75191 implements Serializable {
+        private static final long serialVersionUID = 1L;
 
         @DataField(pos = 1)
         private String firstField;
@@ -157,6 +158,7 @@ public void setNumber(BigDecimal number) {
     
     @CsvRecord(separator = ",", quote = "'", quoting = true, quotingEscaped = 
false)
     public static class BindyCsvRowFormat75192 implements Serializable {
+        private static final long serialVersionUID = 1L;
 
         @DataField(pos = 1)
         private String firstField;
@@ -191,6 +193,4 @@ public void setNumber(BigDecimal number) {
             this.number = number;
         }
     }
-
-
 }
diff --git 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeTrueTest.java
 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeTrueTest.java
index f2f99fa11aa..53c5cd8ef5e 100644
--- 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeTrueTest.java
+++ 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvContainingMultiQuoteCharEscapeTrueTest.java
@@ -120,6 +120,7 @@ public void configure() throws Exception {
     //from https://issues.apache.org/jira/browse/CAMEL-7519
     @CsvRecord(separator = ",", quote = "\"", quoting = true, quotingEscaped = 
true)
     public static class BindyCsvRowFormat75191 implements Serializable {
+        private static final long serialVersionUID = 1L;
 
         @DataField(pos = 1)
         private String firstField;
@@ -157,6 +158,7 @@ public void setNumber(BigDecimal number) {
     
     @CsvRecord(separator = ",", quote = "'", quoting = true, quotingEscaped = 
true)
     public static class BindyCsvRowFormat75192 implements Serializable {
+        private static final long serialVersionUID = 1L;
 
         @DataField(pos = 1)
         private String firstField;
@@ -191,6 +193,4 @@ public void setNumber(BigDecimal number) {
             this.number = number;
         }
     }
-
-
 }
diff --git 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithClassMethodTest.java
 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithClassMethodTest.java
index 4f5b81109e4..3f19055f8c7 100644
--- 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithClassMethodTest.java
+++ 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithClassMethodTest.java
@@ -51,7 +51,7 @@ public void testUnMarshallMessage() throws Exception {
 
         BindyCsvRowFormat7621 body = new BindyCsvRowFormat7621();
         body.setFirstField("123");
-        body.setSecondField("\"\"foo\"\"");
+        body.setSecondField("\"foo\"");
         body.setNumber(new BigDecimal(10));
         template.sendBody("direct:startMarshal1", body);
         
@@ -60,7 +60,7 @@ public void testUnMarshallMessage() throws Exception {
         BindyCsvRowFormat7621 model = 
mockEndPointUnMarshal1.getReceivedExchanges().get(0).getIn().getBody(BindyCsvRowFormat7621.class);
         
         assertEquals("123", model.getFirstField());
-        assertEquals("\"\"FOO\"\"", model.getSecondField());
+        assertEquals("\"FOO\"", model.getSecondField());
         assertEquals(new BigDecimal(10), model.getNumber());
     }
 
@@ -86,6 +86,7 @@ public void configure() throws Exception {
 
     @CsvRecord(separator = ",", quote = "\"", quoting = true, quotingEscaped = 
false)
     public static class BindyCsvRowFormat7621 implements Serializable {
+        private static final long serialVersionUID = 1L;
 
         @DataField(pos = 1)
         private String firstField;
diff --git 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithExternalMethodTest.java
 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithExternalMethodTest.java
index ebc03a7e336..3c0f61f1bd7 100644
--- 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithExternalMethodTest.java
+++ 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvFunctionWithExternalMethodTest.java
@@ -55,7 +55,7 @@ public void testUnMarshallMessage() throws Exception {
 
         BindyCsvRowFormat7621 body = new BindyCsvRowFormat7621();
         body.setFirstField("123");
-        body.setSecondField("\"\"foo\"\"");
+        body.setSecondField("\"foo\"");
         body.setNumber(new BigDecimal(10));
         template.sendBody("direct:startMarshal1", body);
         
@@ -64,7 +64,7 @@ public void testUnMarshallMessage() throws Exception {
         BindyCsvRowFormat7621 model = 
mockEndPointUnMarshal1.getReceivedExchanges().get(0).getIn().getBody(BindyCsvRowFormat7621.class);
         
         assertEquals("123", model.getFirstField());
-        assertEquals("\"\"bar\"\"", model.getSecondField());
+        assertEquals("\"bar\"", model.getSecondField());
         assertEquals(new BigDecimal(10), model.getNumber());
     }
 
@@ -90,6 +90,7 @@ public void configure() throws Exception {
 
     @CsvRecord(separator = ",", quote = "\"", quoting = true, quotingEscaped = 
false)
     public static class BindyCsvRowFormat7621 implements Serializable {
+        private static final long serialVersionUID = 1L;
 
         @DataField(pos = 1)
         private String firstField;
diff --git 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest.java
 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest.java
new file mode 100644
index 00000000000..9728882c1b6
--- /dev/null
+++ 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.csv;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import 
org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote.Order;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import 
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+@ContextConfiguration
+public class BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest extends 
AbstractJUnit4SpringContextTests {
+    
+    private static final String URI_MOCK_RESULT = "mock:result";
+    private static final String URI_DIRECT_START = "direct:start";
+
+    @Produce(uri = URI_DIRECT_START)
+    private ProducerTemplate template;
+
+    @EndpointInject(uri = URI_MOCK_RESULT)
+    private MockEndpoint result;
+
+    private String expected;
+
+    @Test
+    @DirtiesContext
+    public void testUnMarshallMessage() throws Exception {
+
+        expected = "10,A9,'Pauline de 
\"\"Quotes\"\"','O'Donald',ISIN,XD12345678,BUY,Share,2500.45,USD,08-01-2009";
+
+        template.sendBody(expected);
+
+        result.expectedMessageCount(1);
+        result.assertIsSatisfied();
+
+        Order order = 
result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
+        Assert.assertEquals(10, order.getOrderNr());
+        Assert.assertEquals("Pauline de \"\"Quotes\"\"", order.getFirstName());
+        Assert.assertEquals("O'Donald", order.getLastName());
+    }
+
+    public static class ContextConfig extends RouteBuilder {
+        BindyCsvDataFormat camelDataFormat = new 
BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote.Order.class);
+
+        public void configure() {
+            
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
+        }
+    }
+}
\ No newline at end of file
diff --git 
a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesInFieldCsvUnmarshallTest-context.xml
 
b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesInFieldCsvUnmarshallTest-context.xml
new file mode 100644
index 00000000000..30c670dcdb8
--- /dev/null
+++ 
b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesInFieldCsvUnmarshallTest-context.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="   
   http://www.springframework.org/schema/beans      
http://www.springframework.org/schema/beans/spring-beans.xsd      
http://camel.apache.org/schema/spring      
http://camel.apache.org/schema/spring/camel-spring.xsd";>
+  <camelContext id="camelContext-c82c721b-cdcb-4454-9994-26a6cded0e15" 
xmlns="http://camel.apache.org/schema/spring";>
+    <routeBuilder ref="myBuilder"/>
+  </camelContext>
+  <bean
+    
class="org.apache.camel.dataformat.bindy.csv.BindyDoubleQuotesInFieldCsvUnmarshallTest$ContextConfig"
 id="myBuilder"/>
+</beans>
diff --git 
a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest-context.xml
 
b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest-context.xml
new file mode 100644
index 00000000000..b4c657766b0
--- /dev/null
+++ 
b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest-context.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="   
   http://www.springframework.org/schema/beans      
http://www.springframework.org/schema/beans/spring-beans.xsd      
http://camel.apache.org/schema/spring      
http://camel.apache.org/schema/spring/camel-spring.xsd";>
+  <camelContext id="camelContext-8b6febc1-7092-4b97-8847-38f4482d2ca2" 
xmlns="http://camel.apache.org/schema/spring";>
+    <routeBuilder ref="myBuilder"/>
+  </camelContext>
+  <bean
+    
class="org.apache.camel.dataformat.bindy.csv.BindySingleQuotesWithDoubleQuotesInFieldCsvUnmarshallTest$ContextConfig"
 id="myBuilder"/>
+</beans>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Bindy - Unescape double quotes inside CSV field
> -----------------------------------------------
>
>                 Key: CAMEL-12274
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12274
>             Project: Camel
>          Issue Type: Wish
>          Components: camel-bindy
>    Affects Versions: 2.20.2
>            Reporter: Bohdan
>            Assignee: Dmitry Volodin
>            Priority: Minor
>             Fix For: 2.22.0
>
>
> In CSV quote character inside a field is represented by 2 quote characters 
> ([https://en.wikipedia.org/wiki/Comma-separated_values#Standardization]).
> For example, value
> {noformat}
> a"b"c{noformat}
> is represented in CSV as
> {noformat}
> "a""b""c"{noformat}
> . However, after unmarchalling it with bindy, the resulting value is
> {noformat}
> a""b""c{noformat}
> instead of
> {noformat}
> a"b"c{noformat}.
> I know that unescaping quotes can be done manually, for example, by providing 
> method in @DataField annotation. But shouldn't this be the default behavior?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to