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

  • SEARCH
  • Home
  • 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 8205095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:06:30+00:00 2026-06-07T08:06:30+00:00

I just migrated from Ruby 1.8.7 to Ruby 1.9.2 and I keep stumbling on

  • 0

I just migrated from Ruby 1.8.7 to Ruby 1.9.2 and I keep stumbling on string encoding headaches. My MySQL database is all utf8, and yet every time I query from it and lookup the string encoding, I get ASCII-9BIT.

ruby-1.9.2-p180 :002 > Artist.find(1043).name.encoding
 => #<Encoding:ASCII-8BIT> 

So an artist like Sigur Rós prints out as “Sigur R\xC3\xB3s”. Turns out this is causing some problems as my client app expects UTF8 json to be returned by my server (as it’s always been the case). A temporary workaround seems to be adding force_encoding("UTF-8") all over my code but it feels extremely messy especially since Ruby 1.8.7 didn’t need any of these.

I tried adding encoding magic comments, Encoding.default_external to my env file, encoding parameter to my database.yml file, nothing does it.

How am I supposed to deal with Ruby 1.9.x and string encodings?

—

EDIT: In my other Rails app (that’s been Ruby 1.9.2 since the very start), all the MySQL strings seems to be encoded in UTF-8. But the database/tables encoding/charset are exactly the same?!

  • 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-07T08:06:32+00:00Added an answer on June 7, 2026 at 8:06 am

    Well, updating to Rails 3.1.3 and mysql2 0.3.10 seems to have solved my issue (was running Rails 3.0.3 and mysql2 0.2.6). Seems weird to me though, as Ruby 1.9 is over 3y old and Rails 3.0.3 was released way after that, so I don’t see why Rails 3.0.x wouldn’t play nice with Ruby’s 1.9 new string encodings. If anyone can add up on this I would be grateful.

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

Sidebar

Related Questions

We have just migrated from solr3.5 to solr3.6, for all this time we have
I've migrated my database on my mobile device away from VistaDB because it's just
I just migrated from Windows to Ubuntu, and I am trying to install Ruby
We just migrated from MYSQL to Oracle 11g and I have to change some
We have just 'migrated' an SQL Server 2005 database from DEVEL into TEST. Somehow
I just migrated my django application from sqlite3 to mysql 5.1.41. I have a
I've just migrated from Tomcat to JBoss AS 7. So, I configured Mysql datasource
I just migrated from Windows to Mac OS X and have found theres no
I just right now migrated from C# to C++/CLR. First I was annoyed, that
I have just migrated a website from iis6 / WinServer 2k3 to IIS7 /

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.