Cyrus + php Net/IMAP & encoding

From: Pieter Vanmeerbeek (no email)
Date: Wed Oct 04 2006 - 10:55:50 EDT

  • Next message: Dr. Harry Knitter: "seen flag"

    Hi,

    I'm struggling with the encoding of my cyrus installation.

    I have a folder Calendar Partagé , which is stored and known by cyrus as
    'user/pv/Calendrier partag&AOk-'

    However the same folder needs to be consulted by a php process, using
    Net/IMAP.php module.

    The default setting for this module is a special utf_7 + base 64 encoding
    (which seems to be declared by RFC 3501).

    If I try to access this folder using the module I'm getting an error :

    Error: Folder: user/pv/Calendrier partagé, [pear_error: message="NO, Mailbox
    does not exist" code=0 mode=return level=notice prefix="" info=""]

    Further investigation shows that the php module encodes the folder name to
    "user/pv/Calendrier partag&w6k-", which differs from the cyrus storage
    format.

    Manually setting the foldername to the storage format of cyrus does the
    trick.

    Is there anyone experiencing the same problem as I am?

    I'm using PHP 4.4.2, cyrus 2.2.12, Net_IMAP 1.0.3.

    Kin regards
    Pieter

    PS this is the encoding from php :
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>

         function utf_7_encode($str)
        {
            if($this->_useUTF_7 == false ){
                return $str;
            }
            //return imap_utf7_encode($str);

            $encoded_utf7 = '';
            $base64_part = '';
        if(is_array($str)){
            return new PEAR_Error('error');
        }

            for ($i = 0; $i < strlen($str); $i++) {
                //those chars should be base64 encoded
                if ( ((ord($str[$i]) >= 39 ) and (ord($str[$i]) <= 126 )) or
    ((ord($str[$i]) >= 32 ) and (ord($str[$i]) <= 37 )) ) {
                    if ($base64_part) {
                        $encoded_utf7 = sprintf("%s&%s-", $encoded_utf7,
    str_replace('=', '',base64_encode($base64_part)) );
                        $base64_part = '';
                    }
                    $encoded_utf7 = sprintf("%s%s",$encoded_utf7 , $str[$i]);
                } else {
                    //handle &
                    if (ord($str[$i]) == 38 ) {
                        if ($base64_part) {
                            $encoded_utf7 = sprintf("%s&%s-", $encoded_utf7,
    str_replace('=', '',base64_encode($base64_part)) );
                            $base64_part = '';
                        }
                        $encoded_utf7 = sprintf("%s&-", $encoded_utf7 );
                    } else {
                        $base64_part = sprintf("%s%s",$base64_part , $str[$i]);
                        //$base64_part = sprintf("%s%s%s",$base64_part , chr(0)
    , $str[$i]);
                    }
                }
            }
            if ($base64_part) {
                $encoded_utf7 = sprintf("%s&%s-", $encoded_utf7,
    str_replace('=', '',base64_encode($base64_part)) );
                $base64_part = '';
            }
            return $encoded_utf7;
        }

    --
    ---------------------------------------------------
    Able: 1996-2006: already 10 safe years in YOUR company!
    aXs GUARD has completed security and anti-virus checks on this e-mail (http://www.axsguard.com)
    ---------------------------------------------------
    Able NV: ond.nr 0457.938.087
    RPR Mechelen
    ----
    Cyrus Home Page: http://cyrusimap.web.cmu.edu/
    Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
    List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
    

  • Next message: Dr. Harry Knitter: "seen flag"





    Hosted Email Solutions

    Invaluement Anti-Spam DNSBLs



    Powered By FreeBSD   Powered By FreeBSD