encoding - Perl - IMAP search unicode string with X-GM-RAW -


i'm using perl , mail::imapclient module search emails , fetch them gmail server, stuck on problem unicode strings in x-gm-raw.

when send command:

search charset utf-8 x-gm-raw "Новости"

it doesn't work :(

but

search charset utf-8 x-gm-raw "news"

works no problems , returns list of message ids

my perl-script looks follows:

#!/usr/bin/env perl  use utf8::all; use strict; use warnings; use feature 'say'; use mail::imapclient;  $imap = mail::imapclient->new(     server   => 'imap.gmail.com',     user     => 'username@gmail.com',     password => 'secr3t',     ssl      => 1,     uid      => 0,     debug    => 1 );  $imap->select('[gmail]/all mail'); $news = $imap->search('charset utf-8 x-gm-raw "Новости"'); print "@$news"; # print message ids 

debug messages:

started @ wed apr 15 00:25:43 2015 using mail::imapclient version 3.35 on perl 5.020002 connecting io::socket::ssl peeraddr imap.gmail.com peerport 993 proto tcp timeout 600 debug 1 connected imap.gmail.com read:   * ok gimap ready requests 178.47.31.152 e1mb42229459lab sending: 1 login username@gmail.com secr3t sent 43 bytes read:   * capability imap4rev1 unselect idle namespace quota id xlist children x-gm-ext-1 uidplus compress=deflate enable move condstore esearch utf8=accept     1 ok username@gmail.com authenticated (success) sending: 2 select "[gmail]/all mail" sent 29 bytes read:   * flags (\answered \flagged \draft \deleted \seen $label3 $phishing $forwarded $mdnsent old $notjunk notjunk nonjunk $notphishing junk)     * ok [permanentflags (\answered \flagged \draft \deleted \seen $label3 $phishing $forwarded $mdnsent old $notjunk notjunk nonjunk $notphishing junk \*)] flags permitted.     * ok [uidvalidity 596378645] uids valid.     * 36992 exists     * 0 recent     * ok [uidnext 99973] predicted next uid.     * ok [highestmodseq 3390697]     2 ok [read-write] [gmail]/all mail selected. (success) sending: 3 search charset utf-8 x-gm-raw "Новости" sent 41 bytes ... 

and doesn't stop... until kill him ctrl+c

if have solved problem, plz help!)

thanks!

send

0 enable utf8=accept 

first. enable command enables specific server features, in case relevant feature ability use utf-8 in quoted string ("Новости"). rfcs 5161 , 6855 apply if care read more, it's not necessary.

all imap servers allow use utf8 in literal ({14}crlfНовости) or nonsynchronising literal ({14+}crlfНовости), quoted string more convenient , gmail support enable.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -