mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
forcing encoding on 1.9 when dealing with "binary" columns [#4612 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user