huxi commented on code in PR #68: URL: https://github.com/apache/commons-csv/pull/68#discussion_r1759748457
########## src/test/java/org/apache/commons/csv/issues/JiraCsv150Test.java: ########## @@ -0,0 +1,64 @@ +/* + * 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.commons.csv.issues; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.IOException; +import java.io.StringReader; +import java.util.List; + +import org.apache.commons.csv.CSVFormat; +import org.apache.commons.csv.CSVParser; +import org.apache.commons.csv.CSVRecord; +import org.junit.jupiter.api.Test; + +public class JiraCsv150Test { + + private void testDisable(CSVFormat csvFormat, StringReader stringReader) throws IOException { + CSVParser csvParser = null; + try { + csvParser = new CSVParser(stringReader, csvFormat); + final List<CSVRecord> records = csvParser.getRecords(); + assertEquals(1, records.size()); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (csvParser != null) { + csvParser.close(); + } + } + } + + @Test + public void testDisableEscaping() throws IOException { + final StringReader stringReader = new StringReader("\"66\u2441\",,\"\",\"DeutscheBK\ufffe\",\"000\"\r\n"); Review Comment: Hi @garydgregory I'm not the author of [CSV-150](https://issues.apache.org/jira/projects/CSV/issues/CSV-150) or this pull request but I can assure you that I commented above because I had this issue in real data. This happens because everything is terrible, always. The use case is cleansing of malformed data. According to [Wikipedia](https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Non-characters), the expected behavior changed. > Versions of the Unicode standard from 3.1.0 to 6.3.0 claimed that noncharacters "should never be interchanged". [Corrigendum #9](https://www.unicode.org/versions/corrigendum9.html) of the standard later stated that this was leading to "inappropriate over-rejection", clarifying that "[Noncharacters] are not illegal in interchange nor do they cause ill-formed Unicode text", and removing the original claim. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
