Gnus development mailing list
 help / color / mirror / Atom feed
From: Daiki Ueno <ueno@unixuser.org>
Subject: specifying the charset of the query string with nnir/imap
Date: Sun, 23 Sep 2001 11:48:14 +0900	[thread overview]
Message-ID: <m2y9n6k4gh.fsf@deisui.bug.org> (raw)

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

I'm using nnir 1.72.

Whenever I enter Japanese chars, I get the following error:

>Search produced empty results.
>Couldn't request group: Search produced empty results.

The attached patch is just to bring it off by asserting optional
CHARSET argument for the UID SEARCH command.


[-- Attachment #2: nnir.el.diff --]
[-- Type: application/octet-stream, Size: 1888 bytes --]

--- nnir.el~	Sun Sep 23 11:30:13 2001
+++ nnir.el	Sun Sep 23 10:55:45 2001
@@ -461,6 +461,11 @@ (defcustom nnir-excite-remove-prefix (co
   :type '(regexp)
   :group 'nnir)
 
+(defcustom nnir-imap-search-charset nil
+  "*Name of the charset of the strings that appear in the search criteria."
+  :type '(choice (const nil) string)
+  :group 'nnir)
+
 ;; Swish++.  Next three variables Copyright (C) 2000, 2001 Christoph
 ;; Conrad <christoph.conrad@gmx.de>.
 ;; Swish++ home page: http://homepage.mac.com/pauljlucas/software/swish/
@@ -959,6 +964,9 @@ (defun nnir-run-excite-search (query &op
 ;; send queries as literals
 ;; handle errors
 
+(eval-and-compile
+  (autoload 'mm-charset-to-coding-system "mm-util"))
+
 (defun nnir-run-imap (query &optional group)
   (require 'imap)
   (require 'nnimap)
@@ -975,13 +983,21 @@ (defun nnir-run-imap (query &optional gr
 	    (setq buf nnimap-server-buffer) ;; xxx
 	    (message "Searching %s..." group)
             (let ((arts 0)
-                  (mbx (gnus-group-real-name group)))
+                  (mbx (gnus-group-real-name group))
+		  coding-system)
               (when (imap-mailbox-select mbx nil buf)
                 (mapcar
                  (lambda (artnum)
                    (push (vector mbx artnum 1) artlist)
                    (setq arts (1+ arts)))
-                 (imap-search (concat "TEXT \"" qstring "\"") buf))
+		 (if (and nnir-imap-search-charset
+			  (setq coding-system (mm-charset-to-coding-system
+					       nnir-imap-search-charset)))
+		     (imap-search
+		      (concat "CHARSET " nnir-imap-search-charset " TEXT \""
+			      (mm-encode-coding-string qstring coding-system)
+			      "\"") buf)
+		   (imap-search (concat "TEXT \"" qstring "\"") buf)))
                 (message "Searching %s... %d matches" mbx arts)))
             (message "Searching %s...done" group))
         (quit nil))

[-- Attachment #3: Type: text/plain, Size: 25 bytes --]


Regards,
-- 
Daiki Ueno

             reply	other threads:[~2001-09-23  2:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-23  2:48 Daiki Ueno [this message]
2001-09-23 10:05 ` Simon Josefsson
2001-09-23 12:19   ` Kai Großjohann

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=m2y9n6k4gh.fsf@deisui.bug.org \
    --to=ueno@unixuser.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;
as well as URLs for NNTP newsgroup(s).