[squeak-dev] Re: Trying to import csv data, no love

Andreas Raab andreas.raab at gmx.de
Thu Aug 5 06:42:08 UTC 2010


On 8/4/2010 11:25 PM, Casey Ransberger wrote:
> rows := CSVParser parse: (FileStream readOnlyFileNamed:
> '/Users/casey/Desktop/SCDB_2010_01_justiceCentered_Vote.csv')

Try changing this to:

file := FileStream readOnlyFileNamed: 'myfile.csv'.
file converter: Latin1TextConverter new.
rows := CSVParser parse: file.

Cheers,
   - Andreas

> Got...
>
> "Error: invalid utf8 input detected"
>
> Relevant region of code might be...
>
> MultiByteFileStream>>next
>
> | char secondChar state |
> char := converter nextFromStream: self.
>
>
> converter is a UTF8TextConverter. Wondering if maybe I need a different
> text converter? Given that this is a CSV file, I'm thinking the system
> might be expecting UTF-8 where it's actually getting ASCII. The CSV
> package hasn't had any attention in a while, so that makes some sense
> (IIRC there was a shift to UTF-8 not very long ago, no?)
>
> If anyone is wondering, I'm playing with an idea around dynamic
> data-centric web interfaces:) and need some raw data to represent, hence
> the CSV file.
>
> Any ideas?
> --
> Casey Ransberger
>
>
>
>




More information about the Squeak-dev mailing list