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] Bug: UTF-8 error when sending messages
Date: Sun, 30 Jan 2011 16:58:31 +0100	[thread overview]
Message-ID: <1296402962-sup-9808@qwerzila> (raw)
In-Reply-To: <1296270677-sup-4339@poincare>

Excerpts from Adeel Ahmad Khan's message of 2011-01-29 04:11:40 +0100:
> When sending a message containing certain characters, like guillemets
> <http://en.wikipedia.org/wiki/Guillemets>, I experiencing the following error.
> 
>     --- ArgumentError from thread: main
>     invalid byte sequence in UTF-8
>     /usr/lib/ruby/gems/1.9.1/gems/sup-0.12.1/lib/sup/modes/edit-message-mode.rb:497:in `block in mentions_attachments?'

Could you try if this patch fixes it (or just edit the lines manually) ?

- Gaute


From 67a8777875091da6ae57c762f18254509f418a46 Mon Sep 17 00:00:00 2001
From: Gaute Hope <eg@gaute.vetsj.com>
Date: Sun, 30 Jan 2011 16:57:15 +0100
Subject: [PATCH] Attempt to handle encoding errors when searching for attachment string

---
 lib/sup/modes/edit-message-mode.rb |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
index 734a879..8517011 100644
--- a/lib/sup/modes/edit-message-mode.rb
+++ b/lib/sup/modes/edit-message-mode.rb
@@ -494,7 +494,10 @@ private
     if HookManager.enabled? "mentions-attachments"
       HookManager.run "mentions-attachments", :header => @header, :body => @body
     else
-      @body.any? {  |l| l =~ /^[^>]/ && l =~ /\battach(ment|ed|ing|)\b/i }
+      @body.any? {  |l|
+        l.force_encoding 'UTF-8' if l.methods.include?(:encoding)
+        l =~ /^[^>]/ && l =~ /\battach(ment|ed|ing|)\b/i
+      }
     end
   end
 
-- 
1.7.3.5


  parent reply	other threads:[~2011-01-30 15:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-29  3:11 Adeel Ahmad Khan
2011-01-29 18:17 ` Tero Tilus
2011-01-30 15:58 ` Gaute Hope [this message]
     [not found] <mailman.75.1296431981.25874.sup-devel@rubyforge.org>
2011-01-31 18:24 ` Adeel Ahmad Khan
2011-02-01 13:34   ` Gaute Hope

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=1296402962-sup-9808@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