Giter VIP home page Giter VIP logo

Comments (1)

gilleslamiral avatar gilleslamiral commented on May 24, 2024

Dear Pavel,

You're definitively right. This 10 years old bug is also mentioned at:
https://rt.cpan.org/Public/Bug/Display.html?id=11172
which seem to have led to writing a new one
http://search.cpan.org/~pmakholm/Encode-IMAPUTF7-1.05/lib/Encode/IMAPUTF7.pm

The fix is easy, remove the two lines containing PLUSPLACEHOLDER

Copied from http://cpansearch.perl.org/src/FABPOT/Unicode-IMAPUtf7-2.01/lib/Unicode/IMAPUtf7.pm

and then fixed with

https://rt.cpan.org/Public/Bug/Display.html?id=11172

sub imap_utf7_decode {
my ( $s ) = shift( @_ ) ;

     # Algorithm
     # On remplace , par / dans les BASE 64 (, entre & et -)
     # On remplace les &, non suivi d'un - par +
     # On remplace les &- par &
     $s =~ s/&([^,&\-]*),([^,\-&]*)\-/&$1\/$2\-/g ;
     $s =~ s/&(?!\-)/\+/g ;
     $s =~ s/&\-/&/g ;
     return( Unicode::String::utf7( $s )->utf8 ) ;

}

This bugfix will be applied in next public release.

Le 17/01/2015 12:13, Pavel Alexeev aka Pahan-Hubbitus a écrit :

Firstly there bug and you by some reason exclude + sign from utf7 string which leads to its mangle. For example in Russian language word project is "проект" what in UTF7-IMAP encoding represent as "&BB8EQAQ+BDUEOgRC-" but imapsync decode it as "ПроBDUEOgRC-"

I have breaffy look at code and by some reason you are especially leave + sign in imap_utf7_decode routine:

sub imap_utf7_decode {
$s =~s/+/PLUSPLACEHOLDER/g ;
$s =~s/&([^,&-]),([^,-&])-/&$1/$2-/g ;
$s =~s/&(?!-)/+/g ;
$s =~s/&-/&/g ;
$s =~s/PLUSPLACEHOLDER/+-/g ;

     return( Unicode::String::utf7($s  )->utf8 ) ;

}

Additionally I want mention, despite /some/ folder names decoded, in many place except folders list it present as is, for example:

|Excluding folders matching pattern 'BAK_test/Ant/INBOX': [BAK_test/Ant/INBOX/&BB8EQAQ+BDEEOwQ1BDwESw- &BD8EPg- &BD4EQgRHBFEEQgQwBDw- &BEEEQAQwBDIEPQQ1BD0EOARP-] [BAK_test/Ant/INBOX/TODO] [BAK_test/
Ant/INBOX/TODO-ANSWER] [BAK_test/Ant/INBOX/TODO/Answer - &BCEEPgQxBD4EOwQ1BDI-]

|


Reply to this email directly or view it on GitHub #23.

Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06

from imapsync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.