4

I have a CSV file(written in german language) and I m parsing it in my code.

CSVParser newLineParser = new CSVParser('\n');

        try {

            String[] points = newLineParser.parseLine(csv);
            CSVParser commaParser = new CSVParser();
            int pointsLength = points.length;

            for (int i = 1; i < pointsLength; i++) {

                String[] pointComponents = commaParser.parseLine(points[i]);
            }

        } 
        catch (Exception e) {
            Log.e("Exception", e.getMessage());
        }

I am getting error in the parseLine method as:

java.io.IOException: Un-terminated quoted field at end of CSV line

what may be the reason for this error?

3 Answers 3

1

What I get from this is that in your CSV file a quote is opened but isn't closed.

Sign up to request clarification or add additional context in comments.

Comments

0

If you are using OpenCSV API then this could be the problem:

Issue: One or more value in the csv file have multiple lines.

Fix: Use commaParser.parseLineMulti(points[i]) instead.

Source: Http://opencsv.sourceforge.net/apidocs/com/opencsv/CSVParser.html#parseLineMulti(java.lang.String)

Comments

-1

malformed csv file

do some printouts in your loop, to see what happens before the program blows up.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.