diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-06-08 10:25:41 -0400 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-06-08 14:33:28 -0400 |
commit | eb69721c9bf2bd0f8957a231ecc91080b0645b84 (patch) | |
tree | 103bb10a76bbf63a6fc69975fde2378fb6e8ffc3 /activerecord | |
parent | 6b49a71ab719319aafa9d0dce4addd815974bafc (diff) | |
download | rails-eb69721c9bf2bd0f8957a231ecc91080b0645b84.tar.gz rails-eb69721c9bf2bd0f8957a231ecc91080b0645b84.tar.bz2 rails-eb69721c9bf2bd0f8957a231ecc91080b0645b84.zip |
forcing encoding on 1.9 when dealing with "binary" columns [#4612 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index e8a45bb3c6..deb62e3802 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -34,6 +34,10 @@ module ActiveRecord end def binary_to_string(value) + if value.respond_to?(:force_encoding) && value.encoding != Encoding::ASCII_8BIT + value = value.force_encoding(Encoding::ASCII_8BIT) + end + value.gsub(/%00|%25/n) do |b| case b when "%00" then "\0" |