Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Gaute Hope <eg@gaute.vetsj.com>
To: sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] sup 0.14: Encoding::UndefinedConversionError from thread: load threads for thread-index-mode
Date: Thu, 15 Aug 2013 18:39:45 +0200	[thread overview]
Message-ID: <1376584400-sup-6242@qwerzila> (raw)
In-Reply-To: <1376582732-sup-7192@sam.mediasupervision.de>

Excerpts from Gregor Hoffleit's message of 2013-08-15 18:21:43 +0200:
> Sup 0.14 fails for me just after the start with the following exception:
> 
> --- Encoding::UndefinedConversionError from thread: load threads for thread-index-mode
> "\xE2" from ASCII-8BIT to UTF-8
> /var/lib/gems/1.9.1/gems/sup-0.14.0/lib/sup/util.rb:259:in `width'
> /var/lib/gems/1.9.1/gems/sup-0.14.0/lib/sup/util.rb:259:in `display_length'

Hi Gregor,

did you have a lot of messages in your index added by Sup 0.13 or
earlier? Do you get the same error if you move the old xapian folder out
of the way and try to re-index your messages?

It is possible to restore labels using sup-dump and sup-sync --restore.

Otherwise, I used to hackishly fix this error when it occured at some
other point by doing the following fix:

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index 5cff6fa..4579a38 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -256,7 +256,7 @@ end
 
 class String
   def display_length
-    @display_length ||= Unicode.width(self, false)
+    @display_length ||= Unicode.width(self.fix_encoding, false)
   end
 
   def slice_by_display_length len

The problem is that the string which is being formatted (or sought the
width of) is of some sort of encoding (probably already UTF-8), but Ruby
or NCurses or RMail or whatever has lost the encoding, and although the
bytes are encoded they are treated as binary (ASCII-8BIT). There is
generally no way to figure out what the original encoding was, but we
can guess that it is UTF-8 and fix it.

Regards, Gaute



  reply	other threads:[~2013-08-15 16:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 16:21 Gregor Hoffleit
2013-08-15 16:39 ` Gaute Hope [this message]
2013-08-15 16:49   ` Gaute Hope
2013-08-16 13:13     ` Gregor Hoffleit
2013-08-16 15:15   ` Gregor Hoffleit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376584400-sup-6242@qwerzila \
    --to=eg@gaute.vetsj.com \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox