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

Possible problem with sniffencoding? #45

Open
hankinsoft opened this issue Jun 7, 2013 · 2 comments
Open

Possible problem with sniffencoding? #45

hankinsoft opened this issue Jun 7, 2013 · 2 comments
Labels

Comments

@hankinsoft
Copy link

Given the following csv file:
https://mega.co.nz/#!BklVVCSR!JSN_8SIjPfz4eyHdK87H-1U2wyNmC-JkvsDthE-peII

Which has 415 lines and no unicode characters until line 150, the following code "fails":
[NSArray arrayWithContentsOfCSVFile: "file path"];

"fails" in quotes as the method succeeded, but the array only contains 149 entries. At the point it gets to the unicode encoding it silently fails. This gives a false impression that everything was successful (and takes a long time to figure out what is going on :)

@lupiter
Copy link

lupiter commented Jul 15, 2013

I'm experiencing a similar problem, which I 'fixed' by replacing line 78:

 NSStringEncoding encoding = [csv fastestEncoding];

with

 NSStringEncoding encoding = NSUTF8StringEncoding;

Which basically reverts dd43455 and may re-introduce Issue #21, but it does mean the whole thing loads.

@aeberbach
Copy link

I'm parsing a CSV file generated with Numbers 3.1, using the default "Unicode (UTF8)" option when exporting to CSV.

NSStringEncoding encoding = [csv fastestEncoding];

when applied to this file results in NSUnicodeStringEncoding selected in initWithCSVString. For many files this works, but for some it starts displaying chinese characters. Using

NSStringEncoding encoding = [csv smallestEncoding];

results in NSMacOSRomanStringEncoding, and everything parses OK.
Apple bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants