Only call force_encoding on ruby 1.9
This commit is contained in:
parent
461e39f4a5
commit
0472e6cad4
1 changed files with 1 additions and 1 deletions
|
@ -107,7 +107,7 @@ module Potlatch
|
|||
|
||||
# Encode string with two-byte length
|
||||
def self.encodestring(n)
|
||||
n=n.dup.force_encoding("ASCII-8BIT")
|
||||
n=n.dup.force_encoding("ASCII-8BIT") if n.respond_to?("force_encoding")
|
||||
a,b=n.size.divmod(256)
|
||||
a.chr+b.chr+n
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue