Subject: [sup-talk] Ruby 1.9: encodings

From: Andrei Thorp <[email-masked]>
Date: Fri, 6 Nov 2009 22:22:28 -0500

Eh, bad news.

So I've been testing Sup in an 1.9 environment further, and I have
found that there are a great deal of problems with regards to
encodings. "invalid byte sequence in US-ASCII" is something you'll see
frequently. This seems to be when parsing messages that have non-ascii
chararacters.

Ouch :(

Has this already been taken care of in the git somewhere?

-AT
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Gaute Hope <[email-masked]>
Date: Fri, 18 Dec 2009 16:37:16 +0100

I just tried.. im getting the same, afraid im not skilled enough to
figure out what is wrong thou..

--- ArgumentError from thread: load threads for thread-index-mode
invalid byte sequence in US-ASCII
/home/gaute/dev/ruby/sup.git/lib/sup/util.rb:181:in `scan'
/home/gaute/dev/ruby/sup.git/lib/sup/util.rb:181:in `display_length'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:224:in
`block in draw_line_from_array'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:222:in `each'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:222:in
`each_with_index'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:222:in
`draw_line_from_array'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:197:in `draw_line'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/line-cursor-mode.rb:50:in `draw_line'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:48:in `block in draw'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:48:in `each'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/scroll-mode.rb:48:in `draw'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/line-cursor-mode.rb:37:in `draw'
/home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:108:in `draw'
/home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:92:in `redraw'
/home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:329:in `draw_screen'
/home/gaute/dev/ruby/sup.git/lib/sup/buffer.rb:744:in `clear'
/home/gaute/dev/ruby/sup.git/lib/sup/util.rb:520:in `method_missing'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/thread-index-mode.rb:638:in
`load_n_threads'
(eval):12:in `load_n_threads'
/home/gaute/dev/ruby/sup.git/lib/sup/modes/thread-index-mode.rb:609:in
`block in load_n_threads_background'
/home/gaute/dev/ruby/sup.git/lib/sup.rb:78:in `block in reporting_thread'

- gaute

---

From: Andrei Thorp <[email-masked]>
Date: Thu, 24 Dec 2009 11:43:30 -0500

On Sat, Dec 19, 2009 at 1:34 PM, William Morgan
<[email-masked]> wrote:
> Reformatted excerpts from Gaute Hope's message of 2009-12-18:
> 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 <[email-masked]>

Nope, sorry. After deleting that function,

--- ArgumentError from thread: load threads for thread-index-mode
invalid byte sequence in US-ASCII
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/person.rb:10:in `gsub'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/person.rb:10:in `initialize'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:84:in `new'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:84:in
`block in build_message'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:86:in `map!'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:86:in
`build_message'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:176:in
`block (2 levels) in each_message_in_thread_for'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/thread.rb:343:in `call'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/thread.rb:343:in
`block in load_thread_for_message'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:176:in
`block in each_message_in_thread_for'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:176:in `each'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:176:in
`each_message_in_thread_for'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/thread.rb:341:in
`load_thread_for_message'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/thread.rb:333:in
`block in load_n_threads'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:151:in
`block in each_id_by_date'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:144:in
`block in each_id'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:144:in `each'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:144:in `each_id'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/xapian_index.rb:151:in
`each_id_by_date'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/thread.rb:328:in
`load_n_threads'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/modes/thread-index-mode.rb:625:in
`load_n_threads'
(eval):12:in `load_n_threads'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup/modes/thread-index-mode.rb:609:in
`block in load_n_threads_background'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9.1/lib/sup.rb:77:in `block in
reporting_thread'

Though perhaps it would be easier for you to try out 1.9 + sup + utf8
for yourself? I'm sure you already have some UTF8 in your messages, so
you'd just need the new ruby. I have a feeling there are a lot of
small bugs and it may be a hassle doing debugging by proxy (though I'm
willing).

-AT

---

From: William Morgan <[email-masked]>
Date: Sat, 19 Dec 2009 10:34:22 -0800

def camel_to_hyphy

---

From: Andrei Thorp <[email-masked]>
Date: Thu, 24 Dec 2009 11:47:41 -0500

> small bugs and it may be a hassle doing debugging by proxy (though I'm

Err, sorry. And when I say "deleting that function" I mean manually
applying your patch carefully.
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk