Reformatted excerpts from Tarko Tikan's message of 2009-06-09: > When String.display_length was introduced in recent update, it broke > the length for non-UTF8 strings that contain the special characters. > Wrong length results corrupted display (line ends chopped off).
That's a good point. I got a little utf8-centric with those changes. (I'm assuming that your terminal encoding is not UTF-8.) Does this patch fix the issue? If so, I will release an 0.8.1. --- cut here --- diff --git a/lib/sup.rb b/lib/sup.rb index 4f59eaa..20835ae 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -244,7 +244,7 @@ end Redwood::log "using character set encoding #{$encoding.inspect}" else Redwood::log "warning: can't find character set by using locale, defaulting - $encoding = "utf-8" + $encoding = "UTF-8" end ## now everything else (which can feel free to call Redwood::log at load time) diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 8a3004f..d5310bc 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -172,7 +172,13 @@ class Object end class String - def display_length; scan(/./u).size end + def display_length + if $encoding == "UTF-8" + scan(/./u).size + else + size + end + end def camel_to_hyphy self.gsub(/([a-z])([A-Z0-9])/, '\1-\2').downcase -- William <wmorgan-...@masanjin.net> _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk