Author Topic: UTF7-IMAP to UTF-8 Error  (Read 15679 times)

Offline vandenbergen

  • Newbie
  • *
  • Posts: 3
UTF7-IMAP to UTF-8 Error
« on: November 02, 2009, 10:06:08 AM »
I have stille an ENCODING Error:

PHP Error: Could not convert string from UTF7-IMAP to UTF-8. Make sure iconv/mbstring is installed or lib/utf8.class is available. in P:\ServerData\Hosts\webmail.hcs.at\html\program\include\main.inc on line 279 (GET /?_task=mail&_action=check-recent&_t=1257173884499&_list=1&_remote=1&_=1257173884504&_unlock=1)

PHP Error: Could not convert string from UTF7-IMAP to UTF-8. Make sure iconv/mbstring is installed or lib/utf8.class is available. in P:\ServerData\Hosts\webmail.hcs.at\html\program\include\main.inc on line 279 (GET /?_task=mail&_action=check-recent&_t=1257173944497&_list=1&_remote=1&_=1257173944501&_unlock=1)

iconv/mbstring are installed.
I also tried to incluede manual the utf8.class.php in \programm\include\main.inc
// fallback if not PHP modules are available
@include_once('lib/des.inc');
include_once('lib/utf8.class.php');

--> no effect.

iconv
iconv support    enabled
iconv implementation    "libiconv"
iconv library version    1.9

Directive   Local Value   Master Value
iconv.input_encoding   ISO-8859-1   ISO-8859-1
iconv.internal_encoding   ISO-8859-1   ISO-8859-1
iconv.output_encoding   ISO-8859-1   ISO-8859-1

mbstring
Multibyte Support    enabled
Multibyte string engine    libmbfl
Multibyte (japanese) regex support    enabled
Multibyte regex (oniguruma) version    4.4.4
Multibyte regex (oniguruma) backtrack check    On

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

Directive   Local Value   Master Value
mbstring.detect_order   no value   no value
mbstring.encoding_translation   Off   Off
mbstring.func_overload   0   0
mbstring.http_input   pass   pass
mbstring.http_output   pass   pass
mbstring.internal_encoding   no value   no value
mbstring.language   neutral   neutral
mbstring.strict_detection   Off   Off
mbstring.substitute_character   no value   no value

I use PHP 5.2.3
System    Windows NT WEBACT01 5.2 build 3790
Build Date    May 31 2007 09:36:39
Configure Command    cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"
Server API    Apache 2.0 Handler

Offline sfa

  • Newbie
  • *
  • Posts: 3
UTF7-IMAP to UTF-8 Error
« Reply #1 on: November 06, 2009, 03:53:41 AM »
I have the exact same problem.
Running Ubuntu 9.10 and lighttpd/php5
Tried to force load of the utf8 class file from main.inc.
But no result.

Offline sfa

  • Newbie
  • *
  • Posts: 3
UTF7-IMAP to UTF-8 Error
« Reply #2 on: November 06, 2009, 04:38:17 AM »
This problem seems to be related with the location of the files in .mailboxlist
when i used mail/ as basedir it works and when i use no basedir i get this error.
Default mailfolders (container files specified per default in the conf file) gets created like they should but clicking on the folders tab in settings doesn't work and produces this errormessage.

Offline sfa

  • Newbie
  • *
  • Posts: 3
UTF7-IMAP to UTF-8 Error
« Reply #3 on: November 06, 2009, 04:51:25 AM »
Hmm. And apparently it's only for a single user. All the other users works like a charm. Sigh.

Offline KTamas

  • Newbie
  • *
  • Posts: 2
UTF7-IMAP to UTF-8 Error
« Reply #4 on: November 16, 2009, 04:48:53 AM »
I'm having the same issue, only for one user. Also after the user has viewed one or two email messages, (s)he gets logged off and dropped back to the login screen.

For the record we use no root directory cause we have some shared folders.

Debian Lenny etc.

Offline KTamas

  • Newbie
  • *
  • Posts: 2
UTF7-IMAP to UTF-8 Error
« Reply #5 on: November 19, 2009, 05:02:12 AM »
Anyone?...

Offline vtzan

  • Newbie
  • *
  • Posts: 4
same problem here too
« Reply #6 on: December 01, 2009, 05:03:50 AM »
[01-Dec-2009 12:00:24 +0200]: PHP Error: Could not convert string from UTF7-IMAP to UTF-8. Make sure iconv/mbstring is installed or lib/utf8.class is available. in /var/www/webmail/program/include/main.inc on line 279 (GET /?_task=mail&_action=check-recent&_t=1259661627053&_list=1&_quota=1&_remote=1&_=1259661627053&_unlock=1)


any idea?

offcource mbstring is installed.

Offline jjhunt

  • Jr. Member
  • **
  • Posts: 27
UTF7-IMAP to UTF-8 Error
« Reply #7 on: December 14, 2009, 11:12:55 AM »
We are also seeing this error.  We are running v0.2.2 in production, and I'm testing v0.3.1.  I do see the error message changed from "UTF-7" in v0.2.2 to "UTF7-IMAP" in v0.3.1.  

We would sure appreciate an explanation of this!
Thanks much,
Jackie

Offline DeWhite

  • Newbie
  • *
  • Posts: 1
UTF7-IMAP to UTF-8 Error
« Reply #8 on: January 13, 2010, 05:10:52 AM »
I'm having the same issue. And apparently it's only for a single user:
Code: [Select]
PHP Error in /usr/hosting/u1/www/sbconsult/html/mail/program/include/main.inc (279):
Could not convert string from WIN-1251 to UTF-8. Make sure iconv/mbstring is installed or lib/utf8.class is available.

iconv and mbstring is installed and work well.

I am just commented in program\include\main.inc strings 225-250:
Code: [Select]

/*
  // convert charset using bundled classes/functions
  if ($to == 'UTF-8') {
    if ($from == 'UTF7-IMAP') {
      if ($_str = utf7_to_utf8($str))
        return $_str;
    }
    else if ($from == 'UTF-7') {
      if ($_str = rcube_utf7_to_utf8($str))
        return $_str;
    }
    else if (($from == 'ISO-8859-1') && function_exists('utf8_encode')) {
      return utf8_encode($str);
    }
    else if (class_exists('utf8')) {
      if (!$conv)
        $conv = new utf8($from);
      else
        $conv->loadCharset($from);

      if($_str = $conv->strToUtf8($str))
        return $_str;
    }
    $error = true;
  }
*/
 

and everything was working fine!

Excuse me for my bad english!
Hello from Russia ;)

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
UTF7-IMAP to UTF-8 Error
« Reply #9 on: January 13, 2010, 06:05:09 AM »
These warnings appears in logs when mbstring nor iconv nor internal Roundcube converter:
1. doesn't support specified encoding or
2. text for conversion contains characters forbidden in specified encoding or
3. of course there could be a bug in Roundcube.
So, to be sure, you could modify rcube_charset_convert() to log also converted text. It's in $str variable.

Offline jjhunt

  • Jr. Member
  • **
  • Posts: 27
UTF7-IMAP to UTF-8 Error
« Reply #10 on: January 15, 2010, 11:07:02 AM »
Alec,

THANK YOU so much for your post!  I've been struggling with this issue for months, and I took your suggestion of printing out the $str in the error message.  I'm seeing the character '&' is causing the problem when it is in $str.  Finally, I know what is causing it, not sure how to solve it.

Jackie

Offline jjhunt

  • Jr. Member
  • **
  • Posts: 27
UTF7-IMAP to UTF-8 Error
« Reply #11 on: January 21, 2010, 11:35:50 AM »
I've been looking into this a bit more.  I see the error generated when I bring up my list of folders.  The folders are all the files in my home directory on a UNIX system.  Some of those file names have an "&" character in them, and that is what generates the error.

I've done a bit of code tracing, and I see that iconv is being called, and mbstring is being called, and then the routine utf7_to_utf8 is called to do the conversion in the file ~program/lib/utf7.inc.  The routine utf7_to_utf8 does some special handling of the "&" character, and is returning an error.

I'm trying to figure out where the problem lies.  Is it in the assumption that the folder list is in UTF7-IMAP?  It should be ascii I would think.  From what I've read it sounds like UTF7 and UTF8 are similar, so why the special treatment of "&"?  Any clarification on this would be greatly appreciated.  It sounds like this is a common error for RoundCube users, and it'd be nice to get it resolved.

Thanks so much!
Jackie

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
UTF7-IMAP to UTF-8 Error
« Reply #12 on: January 21, 2010, 12:44:50 PM »
RFC3501, 5.1.3. Could you please show that folder (unix) name?

Offline jjhunt

  • Jr. Member
  • **
  • Posts: 27
UTF7-IMAP to UTF-8 Error
« Reply #13 on: January 21, 2010, 01:23:04 PM »
It can be any file name with an "&" in it.  One of our users has a file/folder called "R&R" and that generates the error.

Thanks,
Jackie

Offline diablo81

  • Newbie
  • *
  • Posts: 8
UTF7-IMAP to UTF-8 Error
« Reply #14 on: October 11, 2010, 08:02:19 AM »
I had the same problem. Maybe I have a solution: I looked at utf7_to_utf8 function in utf7.inc file and its behaviour looks like very similar to the standard php function imap_to_utf8.
So what I did it's a simple substitution of the function and it seems to work well.

I would have a confirm from roundcube author, but I think he is really busy.

Anyway if someone could post his experience with this change it will be very nice.


Sorry for my english!