Hi Richard,
Not my code but the program we used to parse csv to pipe in 1988..
#include <stdio.h>
main()
{
char in[1024];
int i,k,l;
while ( gets(&in[0]))
{
l = 0;
k = strlen(&in[0]);
for ( i = 0 ; i < k ; i++)
switch(in[i])
{
case '\"' : if ( l == 0) l = 1;
else l = 0;
break;
case ',' : if (l==1) putchar(in[i]);
else putchar('|');
break;
default : putchar (in[i]);
break;
}
putchar('\n');
}
}
On 16 Apr 2021, at 15:17, Richard Kaye <[email protected]> wrote:
Thanks, Adam. I'm thinking we'll probably have to go down the road of
pre-parsing the CSV to determine what delimiters are being used and then
converting as needed.
--
rk
-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of Adam Buckland
Sent: Friday, April 16, 2021 10:01 AM
To: [email protected]
Subject: Re: Variations in CSV settings by region
When I worked for a data prep house (Late 1980s) we used to use pipe delimited
files and wrote a C utility to strip files back removing the local oddities.
Excel etc can import using various versions if you are using the GUI, not sure
about actually coding it but a short fox pro routing could read a line at a
time and replace commas with escaped commas and then replace semi colons with
commas.
On 16 Apr 2021, at 14:42, Richard Kaye <[email protected]> wrote:
Throwing this one out to the collective wisdom. We're doing a lot with CSV
import/experts these days with our web-based WWC application and are running
into issues with regionalization. Here in the US, a "standard" CSV means commas
between data elements and double quotes around text elements. But in Belgium,
the delimiter is the semi-colon and text elements are not wrapped in double
quotes. As best I can tell, Excel determines what format to use by the OS
settings and not its own application settings. This makes importing from a CSV
a bit of a dance for our Belgian clients as they have to change their regional
settings, import the file that was received in US format, and then change their
settings back. And, of course, changing region affects date and currency
formats. For those of you working with clients from multiple locations where
the standards may be different, what strategies do you use to deal with this?
TIA
--
rk
--- StripMime Report -- processed MIME parts --- multipart/alternative
text/plain (text body -- kept) text/html
---
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message:
https://leafe.com/archives/byMID/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.