RailsCasts Pro episodes are now free!

Learn more or hide this

Edward Wible's Profile

GitHub User: aew

Comments by Edward Wible

Avatar

Agreed - this seems like a big issue per my comment above, and I'm really curious as to how an experienced Rails dev would tackle it.

Avatar

I've also had many frustrating experiences with encoding issues in user generated files. You might want to look at https://github.com/chrisgogreen/roo which allows CSV options, or my fork which incorporates CSV options and implements filthy brute force encoding to UTF-8: https://github.com/aew/roo.

Speaking of which - I've only ever been able to overcome pc/mac encoding issues in user generated files using iconv. String#encode or force_encoding don't seem to do it. I must be missing something as I've run into this repeatedly on different projects and have yet to figure out the "rails way" of dealing with it. I guess I'll keep staring at iconv deprecation warnings for the foreseeable future.

Agree with other comments on large files - roo / active record will be slow and have a large memory footprint which can get you in trouble using delayed_job on Heroku.