[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sup-talk] Ruby 1.9: encodings



Reformatted excerpts from Gaute Hope's message of 2009-12-18:
> I just tried.. im getting the same, afraid im not skilled enough to
> figure out what is wrong thou..

Do the errors still occur if you apply this patch?

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index f99e1c1..92aaff4 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -176,13 +176,7 @@ end
 class String
   ## nasty multibyte hack for ruby 1.8. if it's utf-8, split into chars using
   ## the utf8 regex and count those. otherwise, use the byte length.
-  def display_length
-    if $encoding == "UTF-8" || $encoding == "utf8"
-      scan(/./u).size
-    else
-      size
-    end
-  end
+  def display_length; length end
 
   def camel_to_hyphy
     self.gsub(/([a-z])([A-Z0-9])/, '\1-\2').downcase

-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk