Re: [RFC][DISCUSSION] Remove utf8_decode() and utf8_encode()

From: Date: Mon, 15 Aug 2016 10:47:55 +0000
Subject: Re: [RFC][DISCUSSION] Remove utf8_decode() and utf8_encode()
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-95183@lists.php.net to get a copy of this message
On 15/08/2016 06:26, Stanislav Malyshev wrote:
Hi!
Hi all, utf8_decode() and utf8_encode() are not needed and causing problems than solving.
Why you think they are not needed?
I'm guessing this came about from their mention on another thread. To quote myself:
utf8_decode()/utf8_encode are, at best, extremely misleading names. Many uses of them in my experience go something like this: "I have an encoding problem, it's something to do with UTF-8, I'll try utf8_encode; hm, that didn't work, I'll try utf8_decode instead".
They are certainly used in many, many places; but I would wager that almost all of those uses are broken because they make no effort to confirm that 8859-1 is the right source / target encoding. I think deprecating (but not removing) them might be sensible, because it would discourage this broken logic. They are also trivially polyfillable; and again, anyone doing so will probably realise they misunderstood them and shouldn't be using them in the first place. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#95183) next »