| Bug #48230 | xml_utf8_decode incorrectly decode | ||||
|---|---|---|---|---|---|
| Submitted: | 11 May 2009 2:41am UTC | Modified: | 11 May 2009 1:08pm UTC | ||
| From: | root at 80sec dot com | Assigned to: | |||
| Status: | Bogus | Category: | XML related | ||
| Version: | 5.2.9 | OS: | Linux/win | ||
[11 May 2009 9:27am UTC] jani@php.net
RTFM: "This function decodes data , assumed to be UTF-8 encoded, to ISO-8859- 1."
[11 May 2009 12:24pm UTC] root at 80sec dot com
chr(0xf0).chr(0xc0).chr(0xc0).chr(0xa7) is not a valid utf8 data.
[11 May 2009 1:08pm UTC] derick@php.net
We know it is not, but the function only works on proper UTF-8 like is documented. So there is no bug here, the bug is on your code calling this function. You can't require functions to work like they're not meant to workâbut that's what you're asking here.

Description: ------------ xml_utf8_decode function incorrectly decode. Reproduce code: --------------- <?php $ill=chr(0xf0).chr(0xc0).chr(0xc0).chr(0xa7); $ill=addslashes($ill); echo utf8_decode("$ill"); echo htmlspecialchars ($ill,ENT_QUOTES,"utf-8" ); ?> Expected result: ---------------- it will output a "'" incorrectly. Actual result: -------------- it will output a "'" incorrectly.