Summary | json_encode(): Invalid UTF-8 sequence in argument |
Queue | Horde Framework Packages |
Queue Version | Git master |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | slusarz (at) horde (dot) org |
Requester | rsalmon (at) mbpgroup (dot) com |
Created | 01/20/2011 (5287 days ago) |
Due | |
Updated | 02/21/2011 (5255 days ago) |
Assigned | 01/22/2011 (5285 days ago) |
Resolved | 01/25/2011 (5282 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Taken from
json_encode() chokes on it.
Unfortunately, json_last_error() doesn't help out because of this
issue: http://bugs.php.net/bug.php?id=54058
However, even in this case if json_last_error() worked properly, it
doesn't solve because forcing a charset conversion to UTF-8 doesn't
work either.
Solution: provide error message in preview pane with link to popup
message (which is loaded via straight HTML so it is not subject to
JSON encoding problems).
Bug #9529: On JSON encode error, print error message in preview panehttp://git.horde.org/horde-git/-/commit/9ff07c2c3faa2fe9a77e322c0294d1c38a871897
New Attachment: lex.eml
it seams that json_encode doesn't like the chars right next to '45000
ORLEANS (FRANCE)'
2011-02-14T18:26:26+01:00 DEBUG: HORDE [imp] PHP ERROR: json_encode():
Invalid UTF-8 sequence in argument [pid 8225 on line 252 of
"/var/www/html/hordetest/libs/Horde/Serialize.php"]
2011-02-14T18:26:26+01:00 DE
BUG: 1. Horde::sendHTTPResponse()/var/www/html/hordetest/services/ajax.php:73
2. Horde::escapeJson() /var/www/html/hordetest/libs/Horde.php:564
3. Horde_Serialize::serialize() /var/www/html/hordetest/libs/Horde.php:606
4. Horde_Serialize::_serialize()
/var/www/html/hordetest/libs/Horde/Serialize.php:67
5. json_encode() /var/www/html/hordetest/libs/Horde/Serialize.php:252
6. Horde::errorHandler()
Bug #9529: fix decode() callhttp://git.horde.org/horde-git/-/commit/fe1959fa39723feee2cb717d1dd422ff9445d1d8
Bug #9529: Fix undefined errorhttp://git.horde.org/horde-git/-/commit/c28f2bd6adf2be0645a80fdd5065e0402b1d7e51
-
$ob->setDescription(Horde_Mime::decode($data['description']), 'UTF-8');
+
$ob->setDescription(Horde_Mime::decode($data['description'], 'UTF-8'));
Bug #9529: Fix undefined errorhttp://git.horde.org/horde-git/-/commit/c28f2bd6adf2be0645a80fdd5065e0402b1d7e51
argument 2 for Horde_Mime::decode(), called in
/var/www/html/hordetest/libs/Horde/Mime/Part.php on line 1886 and
defined [pid 31864 on line 298 of
"/var/www/html/hordetest/libs/Horde/Mime.php"]
Bug #9529: Store description internally as UTF-8, not in charset of parthttp://git.horde.org/horde-git/-/commit/929fe1215e12666b847e9fa865320e79bde0a923
by now) I get lots of theses :
2011-01-25T09:59:46+01:00 DEBUG: HORDE [imp] PHP ERROR: Missing
argument 2 for Horde_Mime::decode(), called in
/var/www/html/hordetest/libs/Horde/Mime/Part.php on line 1886 and
defined [pid 31864 on line 298 of
"/var/www/html/hordetest/libs/Horde/Mime.php"]
State ⇒ Resolved
Priority ⇒ 2. Medium
conversion of Horde code to the assumption that all data is internally
stored in UTF-8, parsing the description field of a MIME header was
not properly converted. It was storing the header internally in the
default charset of the part.
Bug #9529: Store description internally as UTF-8, not in charset of parthttp://git.horde.org/horde-git/-/commit/929fe1215e12666b847e9fa865320e79bde0a923
creating this ticket. However, I can see the header (From, To,
Date...) of the message, but not the body.
From there :
- if I doubled-click on the message, the message shows up just fine
in the popup window.
- if I click reply, a reply window appear with the right content.
traditional view.
the string into valid UTF-8, so the in-browser decoding of the JSON
response is failing. This is why you can view the message fine if
viewing in a popup window - since the message there is loaded directly
in HTML rather than via AJAX/JSON.
I click once on the message : I get the errors as described when
creating this ticket. However, I can see the header (From, To,
Date...) of the message, but not the body.
From there :
- if I doubled-click on the message, the message shows up just fine in
the popup window.
- if I click reply, a reply window appear with the right content.
traditional view.
Version ⇒ Git master
Version ⇒
Queue ⇒ Horde Framework Packages
don't get any error message in the logs.
Anyway, this is a Horde_Serialize issue, not an IMP issue.
State ⇒ Assigned
Assigned to Michael Slusarz
Priority ⇒ 1. Low
State ⇒ Unconfirmed
New Attachment: esp.eml
Patch ⇒ No
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ json_encode(): Invalid UTF-8 sequence in argument
Type ⇒ Bug
I get the following errors with firebug and in horde.log :
doActionComplete
TypeError: id is null
eval(r.js.join(';'));
dimpbase.js (ligne 1409)
2011-01-20T17:17:38+01:00 DEBUG: HORDE [imp] PHP ERROR: json_encode():
Invalid UTF-8 sequence in argument [pid 1743 on line 252 of
"/var/www/html/hordetest/libs/Horde/Serialize.php"]
2011-01-20T17:17:38+01:00 DE
BUG: 1. Horde::sendHTTPResponse()/var/www/html/hordetest/services/ajax.php:73
2. Horde::escapeJson() /var/www/html/hordetest/libs/Horde.php:564
3. Horde_Serialize::serialize() /var/www/html/hordetest/libs/Horde.php:606
4. Horde_Serialize::_serialize()
/var/www/html/hordetest/libs/Horde/Serialize.php:67
5. json_encode() /var/www/html/hordetest/libs/Horde/Serialize.php:252
6. Horde::errorHandler()
although code in Serialize.php checks for error 5, function
json_last_error return 0.
I tried to check for error JSON_ERROR_UTF8 (available since PHP 5.3.3
http://www.php.net/manual/en/function.json-last-error.php) without
success.