IMAP搜索非ASCII字符 [英] IMAP search for non-ascii characters

查看:94
本文介绍了IMAP搜索非ASCII字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IMAP GMAIL服务器中搜索非ASCII或日语字符的命令是什么?

What is the COMMAND used to search for non ascii or Japanese characters in IMAP GMAIL server?

推荐答案

正确的方法是使用带文字的CHARSET UTF-8 SEARCH.例如(每行以\ r \ n结尾):

The correct way is to use a CHARSET UTF-8 SEARCH with a literal. For example (each line ends with a \r\n):

> tag UID SEARCH CHARSET UTF-8 TEXT {4}
< + go ahead
> term
< * SEARCH 700 701 702
< tag OK SEARCH done

term应该使用UTF-8编码,而4应该是搜索therm的长度,以字节为单位.

term should be UTF-8 encoded, and the 4 should be the length of the search therm, in bytes after encoding.

例如,以UTF-8编码(6个字节)搜索术语\ xE6 \ x97 \ xA5 \ xE6 \ x9C \ xAC

For example, to search for the term 日本 which is \xE6\x97\xA5\xE6\x9C\xAC in UTF-8 encoding (6 bytes)

> tag UID SEARCH CHARSET UTF-8 TEXT {6}
< + go ahead
> <6 bytes of binary data>
< * SEARCH 700 701 702
< tag OK SEARCH done

除了TEXT之外,您还可以使用其他搜索键,例如BODYTO.在utf-8中搜索应该可以在任何合理的IMAP服务器上进行.其他字符集不太可能受支持.

You can use different search keys besides TEXT, such as BODY or TO. Searching in utf-8 should work on any reasonable IMAP server. Other character sets are less likely to be supported.

这篇关于IMAP搜索非ASCII字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆