]> git.openstreetmap.org Git - rails.git/blobdiff - lib/potlatch.rb
Refactor layer persistence
[rails.git] / lib / potlatch.rb
index 919eb0122986fe5ac923e519c6a9aeb3934af713..359492fa7f19d573d1e03b96d435977d6ebe9007 100644 (file)
@@ -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") if n.respond_to?("force_encoding")
       a,b=n.size.divmod(256)
       a.chr+b.chr+n
     end