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
Csv with semicolon-comma wrong parsing #2239
Comments
|
The overarching issue is locales (in some locales, commas are treated as decimal points and semicolons are the field separators). Excel's general backdoor for the delimiter is the We'd accept a PR that adds an override. The change would be in if(str.slice(0,4) == "sep=") {
// If the line ends in \r\n
if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
sep = str.charAt(4); str = str.slice(7);
}
// If line ends in \r OR \n
else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
sep = str.charAt(4); str = str.slice(6);
}
else sep = guess_sep(str.slice(0,1024));
}
+ else if(opts && opts.FS) sep = opts.FS;
else sep = guess_sep(str.slice(0,1024));and the end code would be X.read(e.target.result, { type: 'string', FS: ";" }) |
|
@SheetJSDev Can I take this issue? |
We have done exactly this workaround on the code side (reading the first line and finding out the separator). I thought it could be done automatically. |
|
The current behavior is consistent with Excel. Consider the original sample file: In the If you are using a regional setting with ";" as the list separator and "," as the decimal symbol, then you will get the parse you expect. In windows 7 these settings can be found in "Control Panel" > "Clock, Language, and Region" > "Region and Language" > "Additional Settings". en_US has the following settings: Note: Excel's backdoor for controlling the list separator is the aforementioned |
|
Can i work on this issue? |



Hi, I'm trying to read a CSV file like this (
;,delimiters):What happens: semicolon from the first line does not become the main separator, the comma from the second line does and it breaks the file's logic.
Code that reads:
Result
I have seen your comment about standard delimiters, but normally semicolon is a basic one (#1087 (comment))
Probably I am doing something wrong? Thanks
The text was updated successfully, but these errors were encountered: