Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF7-IMAP encoding problems #497

Open
jordisalord opened this issue Apr 13, 2021 · 4 comments
Open

UTF7-IMAP encoding problems #497

jordisalord opened this issue Apr 13, 2021 · 4 comments

Comments

@jordisalord
Copy link

Hi there,
at line 210 of file Connection.php this UTF8 conversion is giving me some problems reading an office365 server.

foreach ($mailboxesInfo as $mailboxInfo) { $name = \mb_convert_encoding(\str_replace($this->server, '', $mailboxInfo->name), 'UTF-8', 'UTF7-IMAP'); $this->mailboxNames[$name] = $mailboxInfo; }

It would be much better to do the conversion like this:
$name=\mb_convert_encoding($cleanname, 'UTF8', mb_detect_encoding(\str_replace($this->server, '', $mailboxInfo->name)));

@Slamdunk
Copy link
Collaborator

What exactly are the issues you have?

@jordisalord
Copy link
Author

What exactly are the issues you have?

Office365 server is returning ASCII encoding, not UTF7, so the result of mb_convert_enconding() is empty.

As a result, you can't fetch the Mailboxes (because the script uses its name as identifier inside the array).

@jordisalord
Copy link
Author

I figured out I copied/pasted the purposal too fast.
$cleanname variable is the result of:
$cleanname = str_replace($this->server, '', $mailboxInfo->name);

Then you do:
$name=\mb_convert_encoding($cleanname, 'UTF8', mb_detect_encoding($cleanname));

@Slamdunk
Copy link
Collaborator

Office365 server is returning ASCII encoding, not UTF7

That would be very weird and out of standards, but I'm not surprised.

May you post here the UTF8 encoded name of the mailbox you are using, so I can reconvert it into ASCII in the Test Suite and write a dedicated test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants