From: Hamish Downer <dmishd@gmail.com>
To: sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] Another UTF-8 exception: edit-message-mode.rb
Date: Mon, 20 Jun 2011 22:55:59 +0100 [thread overview]
Message-ID: <1308606546-sup-9510@whisper> (raw)
In-Reply-To: <1306828491-sup-5835@qwerzila>
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
prev parent reply other threads:[~2011-06-20 21:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 7:57 Gaute Hope
2011-06-09 11:30 ` Gaute Hope
2011-06-20 21:55 ` Hamish Downer [this message]
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=1308606546-sup-9510@whisper \
--to=dmishd@gmail.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