]> source.dussan.org Git - redmine.git/commitdiff
scm: add "scm_iconv" method for repository path encoding in abstract_adapter.rb ...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 21 Feb 2011 12:10:16 +0000 (12:10 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 21 Feb 2011 12:10:16 +0000 (12:10 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4906 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/abstract_adapter.rb

index 92af19446a2a939a59df478b27abd2b2c9103722..b0c93bd2ce4755032212a56c0e384c3cdd2d0132 100644 (file)
@@ -221,8 +221,19 @@ module Redmine
         def strip_credential(cmd)
           self.class.strip_credential(cmd)
         end
+
+        def scm_iconv(to, from, str)
+          return nil if str.nil?
+          return str if to == from
+          begin
+            Iconv.conv(to, from, str)
+          rescue Iconv::Failure => err
+            logger.error("failed to convert from #{from} to #{to}. #{err}")
+            nil
+          end
+        end
       end
-      
+
       class Entries < Array
         def sort_by_name
           sort {|x,y|