Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Lite 7

 AfterLogic Forum : AfterLogic WebMail Lite 7
Subject Topic: [PHP] Error: json_encode(): Invalid UTF-8 Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Pavel64
Newbie
Newbie


Joined: 05 November 2009
Online Status: Offline
Posts: 6
Posted: 30 December 2013 at 3:03am | IP Logged Quote Pavel64

Hello,
I encoutered problem with WebMail Lite 7.1.1.1, PHP version.

Logging in into some mailboxes failes - after valid credentials, you get blank screen.

From debugging log, I extracted this problem with some non UTF-8 chaacter in these mailboxes.

[08:30:28.43] [PHP] Error: json_encode(): Invalid UTF-8 sequence in argument
[08:30:28.43] [PHP] /var/www/vhosts/blueghost.vshosting.cz/site1/webmail/libraries/afterlogic/common/managers/integrator/manager.php (line:1526, code:2)
[08:30:28.43] [PHP] Error: json_encode(): Invalid UTF-8 sequence in argument
[08:30:28.44] DB : disconnect from webmail_4@localhost

I also found suggested solution:

http://stackoverflow.com/questions/4663743/how-to-keep-json-encode-from-dropping-strings-with-invalid-characters

$s = iconv('UTF-8', 'UTF-8//IGNORE', $s);

Have you run up against this bug before? How did you solve it?
Back to Top View Pavel64's Profile Search for other posts by Pavel64
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 30 December 2013 at 3:27am | IP Logged Quote Igor

Unfortunately, there's no universal way of cleaning up data from broken UTF-8 sequences, and the method suggested at stackoverflow page isn't 100% reliable either.

The error itself, however, doesn't look critical so there's a good chance that suppressing the error message will help. To do that, modify libraries/afterlogic/common/managers/integrator/manager.php file, line ~1526 as follows:

Code:
return '<script>window.pSevenAppData='.@json_encode( ...


Hope this helps!

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
paddy78
Newbie
Newbie


Joined: 20 April 2014
Location: Germany
Online Status: Offline
Posts: 4
Posted: 23 April 2014 at 1:05am | IP Logged Quote paddy78

I have just deleted my solution for a workaround for the same problem since the real problem has been this line in my mySQL configuration /etc/my.cnf:

init_connect='SET NAMES latin1'

Maybe thats your problem too.
Back to Top View paddy78's Profile Search for other posts by paddy78
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide