This project is archived and is in readonly mode.

#6189 open
William Jones

Serialized Unicode data returning as ASCII

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

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.

Comments and changes to this ticket

  • rails

    rails March 19th, 2011 @ 12:00 AM

    • 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.

  • rails

    rails March 19th, 2011 @ 12:00 AM

    • State changed from “open” to “stale”
  • William Jones

    William Jones April 21st, 2011 @ 04:01 AM

    • 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages