Re: [RFC][DISCUSSION] Remove utf8_decode() and utf8_encode()
| From: | Lester Caine | Date: | Mon, 22 Aug 2016 11:16:18 +0000 |
| Subject: | Re: [RFC][DISCUSSION] Remove utf8_decode() and utf8_encode() | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95369@lists.php.net to get a copy of this message | ||
On 22/08/16 11:55, Michael Wallner wrote:
>> As far as I can see, these functions exist because the XML parser
>> > infrastructure needed them, and someone thought it might be handy to
>> > expose them to users. Funnily enough, the internal versions actually
>> > take a parameter for the target encoding, but only support US-ASCII and
>> > 8859-1:
>> > https://github.com/php/php-src/blob/master/ext/xml/xml.c#L283
>> >
>> > If anything, they should probably have a "str_" prefix, and maybe even
>> > be moved into the string section of the source, exposed in such a way
>> > that the XML parser can still make use of them.
> Thanks for looking deeper. That makes even more sense now.
The original code pre-dates the move to ext/ in 1999 where utf8_decode
is hard coded as ISO-8859-1 but uses xml_utf8_decode internally. At that
time of cause there was no provision for multi-byte characters and the
decoding of a string is hard code in the function. If you look closer
you will see that xml_utf8_decode still expects strings of type XML_Char
* and so utf8_decode() wraps that to hide the differences.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk