Subject: [sup-devel] Encoding of message snippet in xapian

From: Gaudenz Steinlin <[email-masked]>
Date: Wed, 09 Feb 2011 22:27:13 +0100

Hi 

While debuging the trackeback posted below I discovered that my xapian
index contains some of the message snippets in ASCII-8BIT and others
in UTF-8. This leads to probelems when building the thread-view for
collapsed messages for messages wich have non 7-bit ASCII characters
in their snippet. message_patina_lines combines the snippet which
comes from the xapian index and is (sometimes) in ASCII-8BIT with
other parts of the message which are in UTF-8.

I don't know exactly how I ended up with a xapian index which has some
strings in ASCII-8BIT and others in UTF-8. I guess it's because I
first used sup with Ruby 1.8 and only recently switched to Ruby 1.9.1.
What's the expected encoding of things coming from the xapian index?
Is there a way to fix the index? Or is a fix in sup needed for this?
Or should I just recreate my index from scratch?

Running sup with Ruby 1.8 avoids the problem. But I guess it only
masks it because 1.8 is not encoding aware.

Gaudenz

--- Encoding::CompatibilityError from thread: load messages for thread-view-mode
incompatible character encodings: UTF-8 and ASCII-8BIT
/home/gaudenz/projects/sup/lib/sup/modes/thread-view-mode.rb:792:in `message_patina_lines'
/home/gaudenz/projects/sup/lib/sup/modes/thread-view-mode.rb:853:in `chunk_to_lines'
/home/gaudenz/projects/sup/lib/sup/modes/thread-view-mode.rb:724:in `block in regen_text'
/home/gaudenz/projects/sup/lib/sup/thread.rb:68:in `block in each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block (2 levels) in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:174:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:176:in `block in each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each'
/home/gaudenz/projects/sup/lib/sup/thread.rb:175:in `each_with_stuff'
/home/gaudenz/projects/sup/lib/sup/thread.rb:67:in `each'
/home/gaudenz/projects/sup/lib/sup/modes/thread-view-mode.rb:713:in `regen_text'
/home/gaudenz/projects/sup/lib/sup/modes/thread-view-mode.rb:175:in `buffer='
/home/gaudenz/projects/sup/lib/sup/buffer.rb:387:in `spawn'
(eval):1:in `spawn'
/home/gaudenz/projects/sup/lib/sup/modes/thread-index-mode.rb:120:in `block in select'
/home/gaudenz/projects/sup/lib/sup.rb:78:in `block in reporting_thread'
-- 
Ever tried. Ever failed. No matter.
Try again. Fail again. Fail better.
~ Samuel Beckett ~
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: Gaudenz Steinlin <[email-masked]>
Date: Thu, 17 Feb 2011 15:42:58 +0100

HI

> masks it because 1.8 is not encoding aware.

Just for the record. I solved the issue by dumping all labels and
recreating the index with ruby 1.9. That's what I did:
sup-dump > label-dump.txt
rm -r ~/.sup/xapian
sup-sync --restore label-dump.txt --all-sources

While reimporting all my messages I discovered a few message parsing
bugs and some bugs related to GPGME. I created patches for all these
problems and will submit these in separate mails.

Gaudenz