Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

forcing encoding on 1.9 when dealing with "binary" columns [#4612 sta…

…te:resolved]

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
commit eb69721c9bf2bd0f8957a231ecc91080b0645b84 1 parent 6b49a71
@tenderlove tenderlove authored wycats committed
View
4 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -34,6 +34,10 @@ def string_to_binary(value)
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"
Please sign in to comment.
Something went wrong with that request. Please try again.