From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.142.50.5 with SMTP id x5cs58886wfx; Mon, 20 Jun 2011 14:56:21 -0700 (PDT) Received: by 10.229.67.66 with SMTP id q2mr4316398qci.282.1308606980542; Mon, 20 Jun 2011 14:56:20 -0700 (PDT) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id u29si7779501qcs.71.2011.06.20.14.56.20; Mon, 20 Jun 2011 14:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id EC483167835C; Mon, 20 Jun 2011 17:56:17 -0400 (EDT) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by rubyforge.org (Postfix) with ESMTP id 73ABA1858300 for ; Mon, 20 Jun 2011 17:56:06 -0400 (EDT) Received: by wya21 with SMTP id 21so2352639wya.23 for ; Mon, 20 Jun 2011 14:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:subject:from:to:in-reply-to :references:date:message-id:user-agent:content-transfer-encoding; bh=QHiZUfzZ5a1yqePYo/YWvQjEhPOR7LcKm9zdixdgRJ0=; b=n68xfJF5dZHXWMmIBpayUe+benAY2imsqjqVVGumY/ecPXbNL1g53W8JOQ4sWqaBrF O37b5ZVgZob0gNUB+7cwkWBBRE0MddVf11R05zYKWX6cXXimie+MG8/jMdCPYbg2IpJg wMuPbsWEhXFWie2vaKSoezyrEakT3iZCSlB/g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:subject:from:to:in-reply-to:references:date:message-id :user-agent:content-transfer-encoding; b=C/64es50BJyhHG+fL1FajpSDToMflOpgqAoe1ZbECGXYhSxczo2t4cdzg/tM4DRcju PNNcWT8aNbIGQ4nkx4jZ8TxcGUgTo9hJ2bVqy1mGwg3J1JEZv92uuB6gDDGETvFfaA6t U4/UA01tj7RRJW1EaQcbix1INCzoAllr+1c8M= Received: by 10.216.171.18 with SMTP id q18mr5382593wel.47.1308606965719; Mon, 20 Jun 2011 14:56:05 -0700 (PDT) Received: from localhost (cpc12-cmbg15-2-0-cust81.5-4.cable.virginmedia.com [86.30.247.82]) by mx.google.com with ESMTPS id l5sm3146010weq.9.2011.06.20.14.56.02 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2011 14:56:04 -0700 (PDT) From: Hamish Downer To: sup-devel In-reply-to: <1306828491-sup-5835@qwerzila> References: <1306828491-sup-5835@qwerzila> Date: Mon, 20 Jun 2011 22:55:59 +0100 Message-Id: <1308606546-sup-9510@whisper> User-Agent: Sup/git Subject: Re: [sup-devel] Another UTF-8 exception: edit-message-mode.rb X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org Excerpts from Gaute Hope's message of Tue May 31 08:57:39 +0100 2011: > ran into another UTF-8 exception in edit-message-mode, I don't know > exactly what is causing it - but could be UTF-8 chars in some of the > keywords that are sanitized. > > And a patch: > 0001-Fix-UTF-8-exception-in-santizing-body.patch OK, I've had a look at this. From the patch: def sanitize_body body + body.force_encoding 'UTF-8' if body.methods.include?(:encoding) body.gsub(/^From /, ">From ") end I'm not convinced that force_encoding is the best thing to use here. I would expect it to be better to use encode! in most cases. force_encoding does not change the string at all, only the encoding, while encode! will change the string to a new string that may have different underlying bytes. Instead of the above patch could you try: def sanitize_body body + body.encode! 'UTF-8' if body.methods.include?(:encoding) body.gsub(/^From /, ">From ") end and see if that also fixes your bug? Hamish Downer _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel