3 ms·
> Some countries use a comma as decimal separator instead of a colon. And some companies... like Klarna, fixes this wrongly. At least they did a few years back
by mrweasel 7y ago
> Some countries use a comma as decimal separator instead of a colon.
And some companies... like Klarna, fixes this wrongly. At least they did a few years back.
We'd get a CSV file from them, containing payment information, but they ran into the issue that they really wanted to use comma for field separation, but also for krone/øre (decimal) separation. They ingenious solution: Fields are now separated by ", " that's a comma and a space.
Pretty much no CSV parser will accept a multi character field separator. So many fields would just have a space prepended to whatever value was in that field and you'd get a new field, when the parser split the field containing the amount. So now you have say 5 headers but each row would have 6 fields, because the money amount became two fields.
Being on the receiving end you now have to choose, do you want to strip spaces and reconstruct the amount field manually, or parse the CSV file yourself.
- tjalfi 7y agoIf you use .NET then CsvHelper[0] supports multi character separators. [0] https://joshclose.github.io/CsvHelper/ https://joshclose.github.io/CsvHelper/