UTF7 mailbox codification error
Manel Gimeno Zaragozá
magiza83 at hotmail.com
Thu Feb 23 12:36:53 EST 2012
Hello,
As I been explaining in the thread "Problem recover replica" that I'm trying to use Mail::IMAPTalk perl module to fetch some data. I've write this new thread because I get an error when I try to execute the following code:
...
...
...
my $IMAPs1 = Mail::IMAPTalk->new(
Server => $master,
Port => 143,
Username => $username,
Password => $password,
Uid => 1,
);
my $IMAPs2 = Mail::IMAPTalk->new(
Server => $slave,
Port => 143,
Username => $username,
Password => $password,
Uid => 1,
);
$IMAPs1->set_unicode_folders(1);
$IMAPs2->set_unicode_folders(1);
sub Get_Fetch(){
$IMAPs1->select("$_[0]") || die "IMAP error: $@";
$IMAPs2->select("$_[0]") || die "IMAP error: $@";
my $s1sha1 = $IMAPs1->fetch('1:*', 'digest.sha1') || die "IMAP error: $@";
my $s2sha1 = $IMAPs2->fetch('1:*', 'digest.sha1') || die "IMAP error: $@";
my $exit_sha1 = &compare($s1sha1,$s2sha1,"sha1");
if ($exit_sha1 eq 1){
&print_result($s1sha1,$s2sha1);
print "ERROR: sha1 buzon $_[0]\n";
return $exit_sha1;
}
}
...
...
...
I get the following error:
Uncaught exception from user code:
IMAP error: Select failed for folder 'user.dataaper.Comunicaci&APM-n Interna' : IMAP Command : 'select' failed. Response was : no - Mailbox does not exist at ./test.pl line 105, <$_[...]> line 5.
at ./test.pl line 105
main::Get_Fetch('user.dataaper.Comunicaci&APM-n Interna') called at ./test.pl line 86
The problem is when I try to select the "bold folder" I get that it does not exist, but I it does! I've capture the traffic with tcpflow and I see the following:
...
...
192.168.066.093.46078-192.168.066.092.00143: 34 select "user.dataaper.Comunicaci&-APM-n Interna"
192.168.066.092.00143-192.168.066.093.46078: * OK [CLOSED] Ok
34 NO Mailbox does not exist
...
...
As you can see the method "select" sends a wrong "folder" "user.dataaper.Comunicaci&-APM-n Interna". It puts a "-" after "&" and because of that it fails!
If I comment the lines "set_unicode_folders", I get the following error:
Please report to rjlov at /usr/local/share/perl5/Mail/IMAPTalk.pm line 3859, <$_[...]> line 5.
Warning only: IMAPTalk not using unicode_folders at /usr/local/share/perl5/Mail/IMAPTalk.pm line 3860
Mail::IMAPTalk::_fix_folder_name('Mail::IMAPTalk=HASH(0x1e1bee0)', 'user.dataaper.Comunicaci&APM-n Interna') called at /usr/local/share/perl5/Mail/IMAPTalk.pm line 1517
Mail::IMAPTalk::getquota('Mail::IMAPTalk=HASH(0x1e1bee0)', 'user.dataaper.Comunicaci&APM-n Interna') called at ./test.pl line 127
main::Get_Quota('user.dataaper.Comunicaci&APM-n Interna') called at ./test.pl line 87
Please report to rjlov at /usr/local/share/perl5/Mail/IMAPTalk.pm line 3861, <$_[...]> line 5.
I've try to comment the part of the code on IMAPTalk.pm that make the codification conversion, and it works ok if "set_unicode_folfer" lines are not present. But I'm not sure If i can get worst problems in the future about that.
...
...
# if ( $Self->unicode_folders()
# && ( $FolderName =~ m{[^\x00-\x25\x27-\x7f]} ) )
# {
# $FolderName = Encode::encode( 'IMAP-UTF-7', $FolderName );
# }
# if (! $Self->unicode_folders() ) {
# warn("Please report to rjlov");
# Carp::cluck("Warning only: IMAPTalk not using unicode_folders");
# warn("Please report to rjlov");
# }
...
...
# if ( $Self->unicode_folders()
# && ( $FolderName =~ m{&} ) )
# {
# $FolderName = Encode::decode( 'IMAP-UTF-7', $FolderName );
# }
# if (! $Self->unicode_folders() ) {
# warn("Please report to rjlov");
# Carp::cluck("Warning only: IMAPTalk not using unicode_folders");
# warn("Please report to rjlov");
# }
How can I avoid this error? Or force that the method do not "convert" the strings.
Thanks & Regards.
Manel Gimeno Zaragoza
magiza83 at hotmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/info-cyrus/attachments/20120223/f38c844d/attachment.html
More information about the Info-cyrus
mailing list