Re: Moving utf8_encode() and utf8_decode() to ext/standard

From: Date: Sat, 15 Oct 2016 12:31:39 +0000
Subject: Re: Moving utf8_encode() and utf8_decode() to ext/standard
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-96380@lists.php.net to get a copy of this message
Den 2016-10-14 kl. 00:42, skrev Andrea Faulds:
Hi, This is a follow-up to what I wrote in the utf8_encode()/utf8_decode() discussion earlier: Andrea Faulds wrote:
I would propose something else: remove them from the XML extension, and move them somewhere more fitting, like ext/intl, ext/mbstring or maybe ext/standard. These are generic functions which work on any text, not just XML, and their inclusion is mutually superfluous with respect to XML: if you're decoding XML, you don't necessarily need to convert text to/from UTF-8, and if you're converting text to/from UTF-8, you don't necessarily need to deal with XML. Plus, given the names alone, you'd have no idea they're part of the XML extension.
Since these functions are generic string functions that have no dependency on libxml, I've written a patch to move them to ext/standard, and simplified their code a little bit. Pull request here: https://github.com/php/php-src/pull/2160 This doesn't currently do any function renaming or aliasing, but I should probably do that next. Plus, the manual still needs updating. Are there any objections to this move? There'd be no backwards-compatibility break. Thanks! I think this is a very good way forward. At the moment we are
planning a migration project going from PHP 5.x to 7.x where the content is mostly coded in ISO-8859-1 and in some places UTF8. We use these functions to convert when needed, so removing them is in my eyes a bad idea since it would hamper our effort to migrate towards PHP 7. And we want to focus on one thing at the time. Meaning, not mixing PHP 7 & UTF8 migration. We can also not justify the cost for moving content to UTF8 since there is no added value for our end-users in it. So please keep these functions and don't remove them! Regards //Björn Larsson

« previous php.internals (#96380) next »