Gnus development mailing list
 help / color / mirror / Atom feed
* specifying the charset of the query string with nnir/imap
@ 2001-09-23  2:48 Daiki Ueno
  2001-09-23 10:05 ` Simon Josefsson
  0 siblings, 1 reply; 3+ messages in thread
From: Daiki Ueno @ 2001-09-23  2:48 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-23 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-23  2:48 specifying the charset of the query string with nnir/imap Daiki Ueno
2001-09-23 10:05 ` Simon Josefsson
2001-09-23 12:19   ` Kai Großjohann

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).