0

I am using Camel Bindy to process csv files that I recieve from a third party company.

In their csv they are using a separator that is in the extended ascii table: "\u00a4" (code 164 in decimal).

I have tried to set bindy up like this:

@CsvRecord(separator = "\u00a4")

But it fails to separate the columns

When I change the csv separator by something more standard like ";" everything works fine. As this csv is sent from an external company I can't change it myself.

Is there a way I can setup Bindy to support this?

@CsvRecord(separator = "§")
public class Employee {

@DataField(pos = 1)
private String employeeId;
@DataField(pos = 2, pattern = "dd/MM/yyyy")
private Date startDate;
@DataField(pos = 3, pattern = "dd/MM/yyyy")
private Date endDate;
@DataField(pos = 4)
private Character code;

// Getters and Setters

}

CSV content: "aC1aoC3"§"12/04/2017"§"12/04/2017"§"A" "aC1aoC3"§"13/04/2017"§"13/04/2017"§"A" "aC1aoC3"§"14/04/2017"§"14/04/2017"§"A" "aC1aoC3"§"15/04/2017"§"15/04/2017"§"A" "aC1aoC3"§"16/04/2017"§"16/04/2017"§"U" "aC1aoC3"§"17/04/2017"§"17/04/2017"§"U" "aC1aoC3"§"18/04/2017"§"18/04/2017"§"U"

Many thanks for your help

Gilles

Gilles
  • 357
  • 3
  • 20

3 Answers3

1

can you try case 3 and case 4 which are listed in Camel bindy

http://camel.apache.org/bindy.html

different case's

Koushik Ghosh
  • 41
  • 1
  • 6
0

The section sign (§) is 167 in decimal not 164.

Change the separator to \u00A7 like this:

@CsvRecord(separator = "\u00A7")
public class Employee { ... }
mgyongyosi
  • 2,557
  • 2
  • 13
  • 20
  • I think I have an encoding issue because in the string received from Bindy I have the replacement sequence 65533 instead of the separator. – Gilles Apr 17 '17 at 18:01
0

Got it. It was an encoding issue. The character could not be read and was replaced by the 65533 (unicode) replacement character.

I solved it by setting charset=ISO-8859-1 to the ftp connection reading the csv file.

Gilles
  • 357
  • 3
  • 20