Roundcube Community Forum

 

Illegal character encoding specified

Started by toddr123, August 20, 2007, 12:50:11 PM

Previous topic - Next topic

toddr123

Warning: mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified in /home/roundcube/domains/webmailrc.mydomain.com/public_html/new/program/include/main.inc on line 924

Warning: mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified in /home/roundcube/domains/webmailrc.mydomain.com/public_html/new/program/include/main.inc on line 924

Getting this when I login to my personal account, wasn't happening the other day, shortly after install. Seems it's not happening on all accounts and all in all it seems random.

Any ideas? Is it a bug? Something I did wrong during install?
Live Answering Services
From $14.95/mo
http://www.prestigemessaging.com

toddr123

Live Answering Services
From $14.95/mo
http://www.prestigemessaging.com

smeagol

Well, I did just add an @ to mb_convert_encoding so the lines read

 // return if convert succeeded
  if (($out = @mb_convert_encoding($str, $to, $from)) != '')
   return $out;
  }

So at least the warning doesn't show anymore. And as it seems everything still works here for me :)

toddr123

Cool, I will try this.

Most importantly, I now know I am not the only one having this problem. :D

Thanks!
Live Answering Services
From $14.95/mo
http://www.prestigemessaging.com

toddr123

Argg.. :(

I tested it just before making the change to be sure I knew it was broke before and fixed after and now it's back to working again, even before the change.

So, the problem is off and on.

I think it must have something to do with the messages in the mailbox, otherwise it probably wouldn't be off and on.

When the error shows up again, I will try the change. I have it in place now but commented out.
Live Answering Services
From $14.95/mo
http://www.prestigemessaging.com

Z0rn

Hey guys I'm also getting this error, I'm not sure how to fix it. Any ideas? I'm a full blown noob here.

toddr123

The bigger question is, why do we seem to be the only ones getting this error? What's different about our setup? Did you guys all do a fresh install or an upgrade?
Live Answering Services
From $14.95/mo
http://www.prestigemessaging.com

Z0rn

Quote from: toddr123 The bigger question is, why do we seem to be the only ones getting this error? What's different about our setup? Did you guys all do a fresh install or an upgrade?
I did a fresh install today and that's the error I keep getting. I'm totally new to this as I said, so I'm even more in the dark than you guys would be.

preinheimer

I get the same issue, I've posted in the possibly wrong forum (release candidate forum) about it and another issue.

Many (/most) people wont get this because the offending line of code is only executed if you've installed the MBString extension (which provides medicore Unicode support to PHP). It's not installed by default, and tragically few PHP developers internationalize their applications so it's only installed on a small subset of PHP installs.

preinheimer

Okay,

I've worked on this issue a bit myself, debugging the code in main.inc.php, I looked at all the conversions being attempted, and got this list (trimmed):
UTF-8 -> UTF7-IMAP
UTF-8 -> UTF7-IMAP
UTF-8 -> UTF7-IMAP
UTF-8 -> UTF7-IMAP
UTF-8 -> ISO-8859-1
UTF-8 -> ISO-8859-1
UTF-8 -> ANSI
UTF-8 -> ISO-8859-1
UTF-8 -> US-ASCII
UTF-8 -> ISO-8859-1
UTF-8 -> US-ASCII
UTF-8 -> ISO-8859-1
UTF-8 -> ISO-8859-1
UTF-8 -> ISO-8859-1

The warning was only being raised once, so I guessed that mb_convert_encoding() doesn't know what ANSI means, I put in an alternate case structure to handle that case and I don't get the error anymore. This is a.. bad solution, presently I'm returning an empty string for an ANSI string with is sub-optimal. I'll ask someone sooner or later what the best way to convert those is.


preinheimer

last reply, I promise.

ANSI isn't a recognized character set for the mb_string library, it's not on the list http://php.net/manual/en/ref.mbstring.php#mbstring.supported-encodings. However, according to http://www.alanwood.net/demos/ansi.html ANSI is the same as WINDOWS-1252, which is on that magic list. I've added a simple case structure to check for ANSI, and replace it with Windows-1252 which seems to have worked, and likely without losing any data. Any dev can probably use this information to stick a case structure into the next release in a more apropriate location.

rjpearce

There also appears to be a problem with ISO-5589-1 to UTF-8 conversions.

ISO-5589-1 UTF-8

Warning:  mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified in /var/www/webmail/program/include/main.inc on line 248


Thanks

-Richard