From 373a61056389d0b486fd4b1229fbe915c164b9b7 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 31 Oct 2012 20:39:31 +0000 Subject: [PATCH] Force encoding in AMF controller Although the strings are UTF-8 we need to treat them as byte strings for the purposes of encoding AMF responses. --- lib/potlatch.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/potlatch.rb b/lib/potlatch.rb index 919eb0122..35a60dfbb 100644 --- a/lib/potlatch.rb +++ b/lib/potlatch.rb @@ -106,7 +106,8 @@ module Potlatch end # Encode string with two-byte length - def self.encodestring(n) + def self.encodestring(n) + n=n.dup.force_encoding("ASCII-8BIT") a,b=n.size.divmod(256) a.chr+b.chr+n end -- 2.43.2