I’m working with Rails 3 and ya2yaml, and I’m having an encoding issue trying to convert a params hash to yaml. The keys for the params hash are being stored as ASCII-8BIT and the values are being stored as UTF-8. This creates a problem, since ya2yaml doesn’t like ASCII, and if you try to generate yaml from an ASCII string using ya2yaml, you get this:
---
? !binary |
b25l
: "some_value"
Instead of this:
---
someKey : "some_value"
Blech. Does anyone know how to bypass this in ya2yaml, or force a hash’s keys and values to use the same encoding?
I ended up just writing a method that duplicated the params hash and encoded the keys and values in UTF-8: