× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Maybe one could use RFC 4180 as the official standard when discussing double quotes in CSV. RFC 4180 clearly says:

2. Definition of the CSV Format:

7. If double-quotes are used to enclose fields, then a double-quote
appearing inside a field must be escaped by preceding it with
another double quote.

Following RFC 4180, line "2",""This is a quoted title"","BBB" is quoted incorrectly. The correct line should look like this:

"2","""This is a quoted title""","BBB"

Links:

https://stackoverflow.com/questions/17808511/properly-escape-a-double-quote-in-csv
https://www.ietf.org/rfc/rfc4180.txt

Thomas.

-----Ursprüngliche Nachricht-----
Von: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> Im Auftrag von John Yeung
Gesendet: Mittwoch, 16. Dezember 2020 05:23
An: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Betreff: Re: How to handle extra double quotes in CSVR4?

On Tue, Dec 15, 2020, 10:32 PM mlazarus <mlazarus@xxxxxxxxxxxx> wrote:

Example:
"1","This is a regular title","AAA"
"2",""This is a quoted title"","BBB"

In the second record the double quote pairs seem to throw the
processor off. Has anyone run into this? Any solution?


That is not an Excel-produced CSV. I hesitate to say it's "nonstandard"
because there isn't any official standard for CSV, but it isn't surprising that it's not processed cleanly by a CSV-handling package.

Because it doesn't adhere to... let's call it the predominant dialect of CSV, you may need to process it yourself.

I would infer it ALWAYS surrounds char values in quotes, but then doesn't have any other escape mechanisms. So you can account for that yourself, building your own little miniparser with maybe %split or %scan or something.

John Y.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.