Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:01:03+00:00 2026-06-07T10:01:03+00:00

I use Rails 3.2 and the CSV library to import CSV files. I use

  • 0

I use Rails 3.2 and the CSV library to import CSV files.
I use it like this:

CSV.foreach(open(csv_url), :headers => true) do |p|

When I run it on my local computer it works fine, but for some reason it fails for some records on Heroku with the error:

incompatible character encodings: ASCII-8BIT and UTF-8

It fails in a method I’ve defined that simply appends two strings:

def name_and_brand
  "#{name} #{brand.name}"
end

It only fails on some records though, not all.

I’ve read lots of information about this but I still haven’t figured out how to solve it.

If I simply output the encoding of the text I’m parsing it says on my local computer that it is UTF-8, but on Heroku it says ASCII-8BIT.

If I run "a".encoding in the console it outputs UTF-8 and Heroku outputs UTF-8 too.

What I’ve tried so far

# in application.rb
config.encoding = "utf-8"

# in environment.rb
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8

# in other files
# encoding: UTF-8

One difference I’ve found is that Heroku use Ruby 1.9.2 and I use 1.9.3 on my local machine. Could that be it?

Any ideas what I can try more?

EDIT

I found out that you can explicitly choose ruby version on heroku by adding ruby "1.9.3" in the gemfile. Seems to have fixed my issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:01:05+00:00Added an answer on June 7, 2026 at 10:01 am

    I had to explicitly change ruby version to 1.9.3 by adding ruby "1.9.3" in my Gemfile

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use rails 3.0.3 A javascript auto complete needs data like this { query:'Li',
I'd like to use Rails 2.2.2 for one project and Rails 2.3.2 for another.
I am creating a small rails app for personal use and would like to
We use rails version 2.3.5 This error has been reported in SO here I
I use rails_admin One of my partial is like this : %b= questionnaire.title -
I want to use the CSV module with rails 3.2.1 on heroku cedar, but
Can I use Rails 2.3.3 with Ruby's latest version (1.9.1)? On this page ,
I'd like to use rails 3 to develop mobile apps that will be able
In my rails 3 app I use fastercsv to create a csv file to
I would like to use JRuby to run a script which populates a database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.