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] [PATCH] utf-8 script encoding
Date: Thu, 09 Sep 2010 14:02:17 +0200	[thread overview]
Message-ID: <1284033605-sup-442@dolk> (raw)
In-Reply-To: <1266066673-sup-5419@mithink>

[-- Attachment #1: Type: text/plain, Size: 1182 bytes --]

Excerpts from Michael Hamann's message of 2010-02-13 14:51:53 +0100:
> Hi,
> 
> Excerpts from William Morgan's message of 2010-01-23 13:44:39 +0100:
> > Reformatted excerpts from Gaute Hope's message of 2010-01-03:
> > > No. Tab completion fails, and sending fails, I can add names with
> > > UTF-8 chars to the recipient list, but it fails with the last attached
> > > exception. This is the same behaviour as earlier.
> > 
> > That's weird, I would've expected this to help. What's the alternative,
> > adding "u" to the end of every regexp?
> 
> Has there been any progress on this subject? This is imho a quite annoying bug
> as it makes me regularly recover mails from the buffer of screen when having
> written a reply to a message with a subject containing utf-8 chars without
> noticing that.
> 
> Sorry if this should have been fixed already, I'm currently using git next and
> there the problem still exists.
> 

I put target.force_encoding 'UTF-8' on the tab completion of contacts
and labels and that seems to have fixed the issue 36 on Ruby 1.9. See
attached patch; or:
http://gitorious.org/sup/gautehs-mainline/commit/c78e53f13b493afe2ce13c8f312068fe042cd126

- gaute

[-- Attachment #2: 0001-Force-UTF-8-on-label-and-contact-completion.patch --]
[-- Type: application/octet-stream, Size: 1448 bytes --]

From c78e53f13b493afe2ce13c8f312068fe042cd126 Mon Sep 17 00:00:00 2001
From: Gaute Hope <eg@gaute.vetsj.com>
Date: Thu, 9 Sep 2010 13:48:49 +0200
Subject: [PATCH] Force UTF-8 on label and contact completion

Fix issue 36, by forcing UTF-8 encoding on string that will be matched.

Only if the force_encoding method is available to maintain 1.8
compatability.

There is likely to still be a few other places where the equivilent of
this bug still exists.
---
 lib/sup/buffer.rb |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index 04bbdcf..233db3f 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -469,6 +469,7 @@ EOS
           raise "william screwed up completion: #{partial.inspect}"
         end
 
+      target.force_encoding 'UTF-8' if target.methods.include?(:encoding)
       completions.select { |x| x =~ /^#{Regexp::escape target}/i }.map { |x| [prefix + x, x] }
     end
   end
@@ -477,6 +478,7 @@ EOS
     ask domain, question, default do |partial|
       prefix, target = partial.split_on_commas_with_remainder
       target ||= prefix.pop || ""
+      target.force_encoding 'UTF-8' if target.methods.include?(:encoding)
       prefix = prefix.join(", ") + (prefix.empty? ? "" : ", ")
       completions.select { |x| x =~ /^#{Regexp::escape target}/i }.sort_by { |c| [ContactManager.contact_for(c) ? 0 : 1, c] }.map { |x| [prefix + x, x] }
     end
-- 
1.7.2.3


  reply	other threads:[~2010-09-09 12:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-25 14:02 [sup-devel] [issue36] label tab completion with utf-8 chars fail Gaute Hope
2010-01-03 15:51 ` Gaute Hope
2010-01-03 15:56   ` Gaute Hope
2010-01-15 10:23     ` Gaute Hope
2010-01-03 16:07   ` [PATCH] utf-8 script encoding Rich Lane
2010-01-03 16:18     ` Gaute Hope
2010-01-23 12:44       ` [sup-devel] " William Morgan
2010-02-13 13:51         ` Michael Hamann
2010-09-09 12:02           ` Gaute Hope [this message]
2010-09-17 10:54             ` Gaute Hope
2010-10-04  8:40               ` 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=1284033605-sup-442@dolk \
    --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