Leave a comment

Getting Invalid encoding UTF-8 and ASCII-8BIT error while parsing CSV. in Ruby

Once I parsing a CSV file. it will work for ruby1.8 but it give me encoding error while parsing same file using ruby1.9.

 

The following error is soled by just added this line to the string

“Errored string”.force_encoding(“ISO-8859-1”).encode(“utf-8”, replace: nil) 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: