Skip to content

MalformedInputException when parsing csv file with umlauts #766

@ryanthara

Description

@ryanthara

I try to parse a csv file from a public geodata server Fixpunkte_BS.csv that contains umlauts like 'ä' and 'ö' in the first line of the file.

Therefore I use the callback approach.

// Callback
try {
    csv = CsvParser
            .separator(separator)
            .forEach(file2Read.toFile(), new ListCollector<>()).getList();
    return true;
} catch (IOException e) {
    LOGGER.error("Comma separated values file '{}' could not be read.", file2Read.toString());
}

Example:

Punktnummer;Punktkategorie;E (LV95);N (LV95);Höhe (LN02);Lage-Genauigkeit;Lage-Zuverlässigkeit;Höhen-Genauigkeit;Höhen-Zuverlässigkeit;Vermarkungsart;Punktart

It is quite equal if the encoding is 'UTF-8' or 'Windows 1252'. It always ends in the

java.nio.charset.MalformedInputException: Input length = 1.

Did I miss something to avoid this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions