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

fix: if inside string ignore text-delimiters #66

Merged
merged 3 commits into from
May 7, 2024

Conversation

nafiskabbo
Copy link
Contributor

Update CSV to latest version which fixes issue #close2/csv#70. and made one default value 'useAutodetect' to false to make it work.

Description:

If inside an unquoted string, text-delimiters are ignored instead of swallowed.
This (partially?) fixes issue close2/csv#70.
Example: "A B", "C, D" will now produce [["A B",' "C',' D"']] instead of [["A B",' C',' D']].

  • My Usecase:

I had a line containing a comma (,) inside "" in the langs.csv locale file
Example:
contact_info,"Send mail, suggestion or feedback",إرسال بريد، اقتراح أو ملاحظات,"Məktub, təklif və ya rəy göndərin","ইমেল, পরামর্শ বা প্রতিক্রিয়া পাঠান","Mail, Vorschlag oder Feedback senden","Envoyer un courriel, une suggestion ou un retour d'utilisation","Kirim surat, saran atau masukan","Invia mail, suggerimenti o feedback","Hantar surat, cadangan atau maklum balas","Отправить письмо, предложение или отзыв","Posta, öneri veya geri bildirim gönderin",ای‌میل، تجاویز، مشورہ بھیجیں

Here in my app, it was rendering only ["Send mail] and missing the next part of [, suggestion or feedback] as both are separated by comma. After some research I found this issue is already fixed by CSV library in latest version. So I updated CSV to latest here and made 1 change according to it.

@bw-flagship
Copy link
Collaborator

Its great that you upgraded the lib, but why do you change the default value for autodetect?

@nafiskabbo
Copy link
Contributor Author

When autodetect is true, it overrides the delimiters and uses the FirstOccurrenceSettingsDetector. Making it false, it will use the delimiters provided by the csv library.

@bw-flagship
Copy link
Collaborator

So you can set it to false in your app and people who want to use the FirstOccurrenceSettingsDetector, right?

@nafiskabbo
Copy link
Contributor Author

I have made useAutodetect to true and added it as an optional parameter to support the feature. Now anyone who wants to use FirstOccurrenceSettingsDetector, can use it, and people can use the default behavior of CSV also .

@bw-flagship bw-flagship merged commit 1f9f028 into aissat:master May 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants