[Dovecot] Japanese Search

Kazuo Moriwaka moriwaka at valinux.co.jp
Tue Dec 21 05:30:54 EET 2004


Hello,

From: Kazuo Moriwaka <moriwaka at valinux.co.jp>
Subject: Re: [Dovecot] Japanese Search
Date: Mon, 20 Dec 2004 16:08:54 +0900 (JST)

> Now, I can search headers with Japanese strings :-)
> # I test some Subject and From headers.
> But body of messages can't. I'll check it out.

I found a reason for imapd cannot search message body by japanese.
charset_to_ucase_utf8_string() convert key to UTF-8 string,
but context->charset keeps old value(ex. "iso-2022-jp").

When 2nd call of charset_to_ucase_utf8_string(), 
charset(iso-2022-jp) and key value (utf-8 encoded string) are
mismatch. It causes:
-> iconv returns error
  -> key isn't valid
    -> search failed.

I attach a patch for this problem. 
I'm sorry for this patch is just a quick hack. 

For message-header-search.c, I feel this patch isn't need. 
It's just to be safe.

best regards,
-- 
Kazuo Moriwaka 
moriwaka at valinux.co.jp
-------------- next part --------------
Index: lib-mail/message-body-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-body-search.c,v
retrieving revision 1.21
diff -r1.21 message-body-search.c
376c376
< 	ctx->charset = charset;
---
> 	ctx->charset = "UTF-8";
Index: lib-mail/message-header-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-header-search.c,v
retrieving revision 1.13
diff -r1.13 message-header-search.c
57c57
< 	ctx->key_charset = p_strdup(pool, charset);
---
> 	ctx->key_charset = p_strdup(pool, "UTF-8");


More information about the dovecot mailing list