Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Serialized Unicode data returning as ASCII

#6189

I'm running into a really strange phenomena after upgrading from Rails 2.3/Ruby 1.8 to Rails 3/Ruby 1.9. I'm using Postgres, through the pg gem 0.10.0.

When I make a call to a model's string or text fields that contain Unicode, it works correctly, and they are returned with an encoding of UTF-8.

However, I also make use of serialized Hashes in a number of models, and whenever I make a call to read their contents (which worked perfectly prior to the upgrade), I get the following puzzling behavior:

If the contents contains ASCII-only data, it returns as UTF-8 (correctly), and is properly displayed.
If the contents contains Unicode data, it returns as ASCII, and is displayed as escaped characters.

Mixing these two of course throws an encoding error.

Reported by William Jones · December 18th, 2010 @ 09:43 PM

State: open
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. rails
    rails
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    March 19th, 2011 @ 12:00 AM

  2. rails
    rails
    • State changed from open to stale

    March 19th, 2011 @ 12:00 AM

  3. William Jones
    William Jones
    • State changed from stale to open

    [state:open]

    This problem is reproducible still on Ruby 1.9.2, Rails 3.0.7, pg 0.10.1. It should be very easy to confirm this problem's existence, simply create a serialized hash that contains Unicode.

    April 21st, 2011 @ 04:01 AM