OSDN Git Service

commit safe_commit
authorSaito <saitowu@gmail.com>
Fri, 18 Nov 2011 02:55:08 +0000 (10:55 +0800)
committerSaito <saitowu@gmail.com>
Fri, 18 Nov 2011 02:55:08 +0000 (10:55 +0800)
lib/commit_ext.rb

index 91a4c05..0e04591 100644 (file)
@@ -3,13 +3,7 @@ module CommitExt
   attr_accessor :refs
 
   def safe_message
-    message.encode("UTF-8",
-                   :invalid => :replace,
-                   :undef => :replace,
-                   :universal_newline => true,
-                   :replace => "")
-  rescue
-    "-- invalid encoding for commit message"
+    message.force_encoding(Encoding::UTF_8)
   end
 
   def created_at