From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (c9C67BF51.dhcp.bluecom.no [81.191.103.156]) by mx.google.com with ESMTPS id 11sm2249043faw.20.2011.01.30.07.57.35 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 30 Jan 2011 07:57:36 -0800 (PST) Content-Type: text/plain; charset=UTF-8 From: Gaute Hope To: sup-devel Subject: Re: [sup-devel] Bug: UTF-8 error when sending messages In-reply-to: <1296270677-sup-4339@poincare> References: <1296270677-sup-4339@poincare> Date: Sun, 30 Jan 2011 16:58:31 +0100 Message-Id: <1296402962-sup-9808@qwerzila> User-Agent: Sup/git Content-Transfer-Encoding: 8bit Excerpts from Adeel Ahmad Khan's message of 2011-01-29 04:11:40 +0100: > When sending a message containing certain characters, like 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 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