Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svToListConverter().convert doesn`t work on IOS (works on android) #69

Open
echogit opened this issue Nov 29, 2023 · 3 comments
Open

svToListConverter().convert doesn`t work on IOS (works on android) #69

echogit opened this issue Nov 29, 2023 · 3 comments
Assignees
Labels

Comments

@echogit
Copy link

echogit commented Nov 29, 2023

I have a csv on this format with 28 lines:

id,name,image
familia,Família,familia.jpg
minhafamilia,Minha Família,minha-familia.jpg
escola,Escola,escola.jpg
sentimentos,Sentimentos,sentimentos.jpg

On android it creates a list of 28 itens, each one with 3 itens, just as the csv.

On IOs it creates a list of 61 itens, ignoring the first field and adding the 2nd and 3rd field on a sequence. Weird. I`m 3 hours here trying to find out what the problem was.

my code:

     final String categoriesCsvContent = await rootBundle.loadString('assets/csvs/$categoriesCsvFileName');
    _categoriesCsvData = CsvToListConverter().convert(categoriesCsvContent);

I got the problem just now, it is the eol, so I just changed like this:

    categoriesCsvContent = await rootBundle.loadString('assets/csvs/$categoriesCsvFileName');
    categoriesCsvContent = categoriesCsvContent.replaceAll('\n','\r\n');

But it would be nice if the code could treat this automatically.

@close2 close2 self-assigned this Nov 29, 2023
@close2 close2 added the bug label Nov 29, 2023
@hedihadi
Copy link

came here to make this post, it works fine on Android but not on IOS

@close2
Copy link
Owner

close2 commented Oct 31, 2024

@hedihadi Could you please confirm, that you are using the same file.

If yes, did you try to adjust the EOL as mentioned in the first comment?

@close2
Copy link
Owner

close2 commented Oct 31, 2024

@hedihadi What happens if you use:

var d = FirstOccurrenceSettingsDetector(eols: ['\r\n', '\n'],
                                            textDelimiters: ['"', "'"]);

CsvToListConverter(csvSettingsDetector: d);

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants