A nasty hack, but fixes a previous utf8-centric change.
Redwood::log "using character set encoding #{$encoding.inspect}"
else
Redwood::log "warning: can't find character set by using locale, defaulting to utf-8"
- $encoding = "utf-8"
+ $encoding = "UTF-8"
end
## now everything else (which can feel free to call Redwood::log at load time)
end
class String
- def display_length; scan(/./u).size end
+ ## 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"
+ scan(/./u).size
+ else
+ size
+ end
+ end
def camel_to_hyphy
self.gsub(/([a-z])([A-Z0-9])/, '\1-\2').downcase