Author Topic: Illegal character encoding specified  (Read 8564 times)

Offline toddr123

  • Jr. Member
  • **
  • Posts: 28
Illegal character encoding specified
« on: August 20, 2007, 12:50:11 PM »
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

Offline toddr123

  • Jr. Member
  • **
  • Posts: 28
Re: Illegal character encoding specified
« Reply #1 on: August 22, 2007, 12:05:52 AM »
Anyone?
Live Answering Services
From $14.95/mo
http://www.PrestigeMessaging.com

Offline smeagol

  • Newbie
  • *
  • Posts: 3
Re: Illegal character encoding specified
« Reply #2 on: August 22, 2007, 03:18:01 AM »
Well, I did just add an @ to mb_convert_encoding so the lines read

Code: [Select]
 // 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 :)

Offline toddr123

  • Jr. Member
  • **
  • Posts: 28
Re: Illegal character encoding specified
« Reply #3 on: August 22, 2007, 10:37:30 AM »
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

Offline toddr123

  • Jr. Member
  • **
  • Posts: 28
Re: Illegal character encoding specified
« Reply #4 on: August 22, 2007, 11:17:15 AM »
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

Offline Z0rn

  • Newbie
  • *
  • Posts: 4
Re: Illegal character encoding specified
« Reply #5 on: August 22, 2007, 09:13:05 PM »
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.

Offline toddr123

  • Jr. Member
  • **
  • Posts: 28
Re: Illegal character encoding specified
« Reply #6 on: August 22, 2007, 09:17:39 PM »
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

Offline Z0rn

  • Newbie
  • *
  • Posts: 4
Re: Illegal character encoding specified
« Reply #7 on: August 22, 2007, 09:26:07 PM »
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.

Offline preinheimer

  • Newbie
  • *
  • Posts: 7
Re: Illegal character encoding specified
« Reply #8 on: September 05, 2007, 11:59:16 PM »
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.

Offline preinheimer

  • Newbie
  • *
  • Posts: 7
Re: Illegal character encoding specified
« Reply #9 on: September 06, 2007, 12:14:24 AM »
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):
Code: [Select]
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.

Offline preinheimer

  • Newbie
  • *
  • Posts: 7
Re: Illegal character encoding specified
« Reply #10 on: September 06, 2007, 12:15:13 AM »
s/->/<-

Offline preinheimer

  • Newbie
  • *
  • Posts: 7
Re: Illegal character encoding specified
« Reply #11 on: September 06, 2007, 12:31:22 AM »
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.

Offline rjpearce

  • Newbie
  • *
  • Posts: 1
Illegal character encoding specified
« Reply #12 on: November 14, 2008, 03:39:28 PM »
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