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 6169469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:51:48+00:00 2026-05-23T22:51:48+00:00

I recently encountered a strange problem: In Ruby 1.9, with the updated CSV library,

  • 0

I recently encountered a strange problem:

In Ruby 1.9, with the updated CSV library, I define

options = {:headers => true, :col_sep => ';', :encoding => 'UTF-8'}

which works fine the first time I pass it as an argument to CSV.read.

But when I do the same time in the next line, with another file, the encoding is obviously ignored!

So while this works as it should:

options = {:headers => true, :col_sep => ';', :encoding => 'UTF-8'}
stockdata   = CSV.read('CurrentStock_1.csv', options)
auctiondata = CSV.read('Export_auktion_ebay-einstellungen.csv', {:headers => true, :col_sep => ';', :encoding => 'UTF-8'})

I can’t shortcut like this:

options = {:headers => true, :col_sep => ';', :encoding => 'UTF-8'}
stockdata   = CSV.read('CurrentStock_1.csv', options)
auctiondata = CSV.read('Export_auktion_ebay-einstellungen.csv', options)

auctiondata then is all in ASCII-8Bit.

Now, maybe that is not a bug; can anyone tell me about this kind of behavior, is it necessary to freeze the options hash, or are there any other best practices?

  • 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-05-23T22:51:48+00:00Added an answer on May 23, 2026 at 10:51 pm

    It is a bug. It’s an easy mistake to make, I blogged about Rails doing this in that past too.

    This bug was unwittingly fixed for the upcoming Ruby 1.9.3.

    In the meantime, you can pass options.dup to avoid the side effects of CSV.read.

    The same problem was still present with CSV.generate and will be fixed for Ruby 1.9.3 too.

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

Sidebar

Related Questions

I recently encountered a strange problem on my website. Images with æ ø and
I'm working with MVC recently and I've encountered a strange problem while trying to
I have just encountered very strange problem - my GWT app hosted on Google
I recently encountered very strange behaviour with the UIImagePickerController. On our main view we
I've recently encountered a problem with OpenX. I can no longer choose zones to
I've recently encountered the following problem with my application: it didn't show any console
I'm quite new at WPF and recently encountered a problem. I got an ObservableCollection<
I recently encountered a few cases where a server would distribute an event stream
I've recently encountered an odd situation when computing the hash Code of tuples of
I've been doing some reading recently and have encountered the Law of Demeter. Now

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.