Req #60429 [Com]: utf8_encode and utf8_decode functions should be deprecated

From: Date: Mon, 22 Aug 2016 14:21:40 +0000
Subject: Req #60429 [Com]: utf8_encode and utf8_decode functions should be deprecated
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203488@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60429&edit=1

 ID:                 60429
 Comment by:         daniel-php at easetechnology dot co dot uk
 Reported by:        deceze at gmail dot com
 Summary:            utf8_encode and utf8_decode functions should be
                     deprecated
 Status:             Assigned
 Type:               Feature/Change Request
 Package:            *XML functions
 PHP Version:        Irrelevant
 Assigned To:        yohgaki
 Block user comment: N
 Private report:     N

 New Comment:

Additionally, utf_encode and utf8_decode appear to be part of the XML extension, and it
shouldn't be necessary to include an XML parser just for two character conversion functions.


Previous Comments:
------------------------------------------------------------------------
[2011-12-02 01:37:45] deceze at gmail dot com

Description:
------------
The purpose of the functions utf8_encode and utf8_decode are time and again 
misunderstood and have probably caused more encoding related problems than they 
have solved. The biggest reason for this is their naming. Their purpose is to 
*convert* the encoding of a string from ISO-8859-1 to UTF-8, yet they are named 
in a way that suggests some other magical function that is necessary to work 
with UTF-8 text. Users looking for "UTF-8 support" in their app quickly find 
these functions due to their naming and use them without understanding what they 
do, often only testing with ASCII text which appears to work fine of first 
sight.

Why is ISO-8859-1 presumed to be the default encoding when converting to UTF-8, 
hence why do these functions occupy such a prominent spot in the namespace? 
There's simply no good reason for it.

The same functionality is available through iconv and mb_convert_encoding. 
Therefore I suggest to slowly deprecate utf8_encode and utf8_decode to clear up 
a recurring confusion and consolidate features into the existing, much more 
versatile iconv and mb_ functions.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=60429&edit=1


Thread (3 messages)

« previous php.bugs (#203488) next »