C# Imap search command with special characters like á,é

可紊 提交于 2020-01-09 11:53:28

问题


I'm working on an imap client search function.

I use this command: UID SEARCH FROM PÉTER

When I run this command i get the following error: Error in IMAP command UID SEARCH: 8bit data in atom

I get this error when my pattern string(for example PÉTER) contains accentuated character.

What is the solution? What sholud I do?

Edit: I try with UTF-8 encoded string (UID SEARCH FROM PÉTER), it runs without error, but it doesn't give back any result. I check the test email account, and there are many mails with this sender.


回答1:


In IMAP you need to send 8-bit data as string literals.

Literal syntax: {byte_count} CRLF number-of-bytes

Example search: cmdTag SEARCH charset UTF-8 subject {4} CRLF test CRLF



来源:https://stackoverflow.com/questions/7426661/c-sharp-imap-search-command-with-special-characters-like-%c3%a1-%c3%a9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!