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' codec can't decode byte 0xd0 in position 0 #299
Comments
I have also tried to get it manually as described here: And have got exactly the same result (the first run is OK, then error). |
@nicolas33 , I have discovered interesting information while playing with options:
So the issue probably lays somewhere in I have also tried git master to be sure everything is the same - yes, am sure :) |
Adding |
What's the output of |
⋊> ~ offlineimap --info
OfflineIMAP 6.6.1
Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
Remote repository 'me-yandex-remote': type 'IMAP'
Host: imap.yandex.ru Port: None SSL: True
Establishing connection to imap.yandex.ru:993
Server supports ID extension.
Server welcome string: * OK Yandex IMAP4rev1 at imap29j.mail.yandex.net:993 ready to talk with ::ffff:some-IP:54140, 2016-Feb-01 19:10:29, TAL8OH3Px8cb
Server capabilities: ('IMAP4REV1', 'CHILDREN', 'UNSELECT', 'LITERAL+', 'NAMESPACE', 'XLIST', 'BINARY', 'UIDPLUS', 'ENABLE', 'ID', 'IDLE', 'MOVE')
Folderlist:
Archive
INBOX
Trash
&BBgEQQRFBD4ENARPBEkEOAQ1- -> Исходящие
&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1- -> Отправленные
&BCEEPwQwBDw- -> Спам
&BCMENAQwBDsENQQ9BD0ESwQ1- -> Удаленные
&BCcENQRABD0EPgQyBDgEOgQ4- -> Черновики
Local repository 'me-yandex-local': type 'Maildir'
Folderlist:
Trash
Отправленные
Удаленные
Archive
INBOX
Исходящие
Черновики
Спам
⋊> ~ Not sure it is important, but |
My best guess is that the As you already know, UTF-8 never got a successfull implementation despite serious attempts. I'm not willing to go into this further because I don't want to replay the match, again. IOW, I'm not surprised the same limitations are surfacing in different ways depending on the cases. I've merge the current implementation because it's small changes in the code. However, it seriously changes the stability of the program. That's why it will likely never be marked stable. The current approach is : if it works for you, you're lucky and you might choose to go for it. If it doesn't, sorry but this feature is known to not work in many cases and it's not available to you. Enabling this feature might be a poor choice in the future with new releases since it's not supported at all. Anyway, this is still a valid bug report. If one day someone is willing to dig into this, the bug tracker is where to start. Keeping this open. |
@nicolas33 , in the issue context - must I try https://github.com/OfflineIMAP/imapfw ? |
I aim imapfw at replacing OfflineIMAP in the long term. You might like to try it now so you can share your expectations in details but it won't sync anything. It's still work in progress. I want early support for UTF-8, yes. I did not talk about imapfw because it's not ready yet. Things are going further at the rate of free time and contributions. ,-) |
So, |
I am also suffering from this and see it as an inacceptable limitation (currently trying to figure out if I can build my email backup/handling infrastructure on offlineimap). I do not want to have folders like I've collected somewhat more info. When repeatedly syncing a mailbox it starts well, establishing the connection, then
which is followed by a sequence of pairs like
going through all the toplevel folders of the mailbox. This may also include special characters:
Then follows the suspicious action
(with The next thing that can be seen is the error
followed by the actual Python backtrace
|
We failed at learning offlineimap to work with UTF-8, sorry. |
I found a workaround with the external utf file mentioned in the original post. I will give more details when I have the chance. It looks like it works (for me) now :-) |
@gaydenko probably you're not into this topic anymore by now, but I'll post my findings anyway as they may become useful for others stumbling over this.
What I did is save the code from http://piao-tech.blogspot.de/2010/03/get-offlineimap-working-with-non-ascii.html and saved it as a file which is included via the Then I entered (as directed by that post)
In the remote part of the configuration. The trick is to add the reverse operation in the local part of the config
Basically this can work because "imap4-utf-7" is created as a "real" encoding, so decode and encode can work in both directions. If I can find where the options are actually used in the now built-in functionality I may try to find a way to integrate it into a pull request. |
Would be so great to have a patch for this. Though, there must be no regression. This must be declared experimental and enabled via a configuration option. Good work, BTW. |
I've started with something but need further guidance on the integration. If you look at the branch on my fork you will see that I integrated the code from this blog post and provided two interface functions to convert foldernames in both directions. This seems to work properly, and I think it is acceptable to add this file, as it is only imported when requested by the user. The third commit adds preliminary integration: adding However, this integration is far from ideal, as discussed in the commit message. But I didn't see (yet) how to implement the integration as it should be. |
OH STOP! Don't look at it yet, I do have to repair an embarrassing mistake I just realized ... (I did everything in the wrong direction (only regarding naming) |
OK, I fixed it: The previous comment is still true, but:
|
Please add new or extend the issues at https://github.com/uliska/offlineimap/issues |
I have the impression I'm getting closer :-)
Actually this makes the (what is of course still missing before opening a pull request is a documenting entry in the example .conf file). |
Ok.
I wonder what would happen for users (wrongly) enabling utf8foldernames and having IMAP/IMAP setups.
We could call for some other contributors to test this once applied to the 'next' branch.
Yes, I'm fine removing this option. As far as this option can still work when utf8foldernames is disabled I'd rather to keep it for some time. IOW, I think we should stop the sync of the account when both are enabled for this account.
Good! Don't forget to add a note that this feature is still not tested with nametrans. Mark the option experimental ( |
I've now made
It will probably break things and either produce scrambled folder names on the "local" IMAP repository or (probably) fail with an exception because it can't write to that. This is ugly, but actually you could already produce this behaviour with the existing I have thought about it and I think the problem should be handled slightly differently than it currently is. Encoding from utf-8 to IMAP utf-7 should not be handled in the Maildir folder class but also in the IMAP folder class. Basically we should always treat folder names as utf-8 and only do the conversions at the border between an IMAP folder and the internal representation. I will look into this, and somehow I have the feeling that if we find an elegant way to do this supporting utf-8 conversion for IMAP folders could eventually become a default feature. |
Why to introduce the utf8foldernames, then? I'm not sure superseding decodefoldernames is great because both don't imply the same nametrans, AFAICT. Either we supersede the current node with great release notes or we introduce yet another option. Both is confusing. EDIT: code*
I think you're right. I was thinking that preventing from this incorrect behaviour would not be hard to introduce. ,-)
I fully agree.
Sure! |
@uliska I think I won't reply in your fork anymore. We've passed the early stages for this feature and I'd rather all the contributors can follow the contributions here (or they won't). Please, make PR for the next reviews. We don't care much how many PR this will require, so feel free. ,-) |
OK. Having issues on my fork was intended as a private todo list anyway.
OK. I'll mark them as WIP to indicate when I don't consider them ready yet.
As the new option is located at the account level it's a "new" one anyway.
Going from IMAP to Maildir they imply the same thing. The other direction hadn't been possible yet.
Hm, I'm not in the position to argue but I think that's not completely true (because the new option is at a different level). What I think will be necessary is
I don't think this is terribly confusing. At least not more confusing as any added functionality can be. |
Ok.
Ok. What about only renaming utf8foldernames to decodefoldernames? The new code would appear to users as just a move to the upper section. I'm nitpicking, here. |
I have no problem with renaming it "back". I would have the impression this is more confusing, but since we are talking about functionality that had already been labeled experimental this will be not an issue, I think. But what I would say is: if we provide a |
Actually, I've had the feeling that your feature was not exactly code refactoring of the Most of the users don't read the changelogs. Hence,
I'm fine with whatever changes for the Hope this helps. |
Add code to reencode IMAP folder names to regular utf-8. This starts an implementation that will add a new config option `utf8foldernames` on account level which will fix OfflineIMAP#299 and on the long run replace the current `decodefoldernames` option. This commit introduces code to register an `imap4_utf_7` codec on which two-way conversion methods will later be built. Signed-off-by: Urs Liska <git@ursliska.de>
Add code to reencode IMAP folder names to regular utf-8. This starts an implementation that will add a new config option `utf8foldernames` on account level which will fix OfflineIMAP#299 and on the long run replace the current `decodefoldernames` option. This commit introduces code to register an `imap4_utf_7` codec on which two-way conversion methods will later be built. Original code by (https://www.blogger.com/profile/16648963337079496096), taken from http://piao-tech.blogspot.no/2010/03/get-offlineimap-working-with-non-ascii.html In the comment http://piao-tech.blogspot.com/2010/03/get-offlineimap-working-with-non-ascii.html?showComment=1316041409339#c669880170006851138 indicates that this code is expected to be incorporated into offlineIMAP and therefore the author implicitly agrees to put it under this license. Signed-off-by: Urs Liska <git@ursliska.de> (cherry picked from commit 8691dd5)
Add code to reencode IMAP folder names to regular utf-8. This starts an implementation that will add a new config option `utf8foldernames` on account level which will fix #299 and on the long run replace the current `decodefoldernames` option. This commit introduces code to register an `imap4_utf_7` codec on which two-way conversion methods will later be built. Original code by (https://www.blogger.com/profile/16648963337079496096), taken from http://piao-tech.blogspot.no/2010/03/get-offlineimap-working-with-non-ascii.html In the comment http://piao-tech.blogspot.com/2010/03/get-offlineimap-working-with-non-ascii.html?showComment=1316041409339#c669880170006851138 indicates that this code is expected to be incorporated into offlineIMAP and therefore the author implicitly agrees to put it under this license. Signed-off-by: Urs Liska <git@ursliska.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Add code to reencode IMAP folder names to regular utf-8. This starts an implementation that will add a new config option `utf8foldernames` on account level which will fix OfflineIMAP#299 and on the long run replace the current `decodefoldernames` option. This commit introduces code to register an `imap4_utf_7` codec on which two-way conversion methods will later be built. Original code by (https://www.blogger.com/profile/16648963337079496096), taken from http://piao-tech.blogspot.no/2010/03/get-offlineimap-working-with-non-ascii.html In the comment http://piao-tech.blogspot.com/2010/03/get-offlineimap-working-with-non-ascii.html?showComment=1316041409339#c669880170006851138 indicates that this code is expected to be incorporated into offlineIMAP and therefore the author implicitly agrees to put it under this license. Signed-off-by: Urs Liska <git@ursliska.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Hi! I know utf7 <-> utf8 folder conversion is experimental, but as far as the feature absent would be an absolute show stopper for many users (and I'm among them), I guess the report is legal :)
So, the first
offlineimap
run is OK, folders are created, messages are got. The second results in:Is it possible to workaround the issue?
Also I'm ready to switch to git head would be directed there :)
The text was updated successfully, but these errors were encountered: