Re: What should we do with utf8_encode and utf8_decode?

From: Date: Wed, 22 Dec 2021 09:00:55 +0000
Subject: Re: What should we do with utf8_encode and utf8_decode?
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-116713@lists.php.net to get a copy of this message
On 21/12/2021 23:20, Wade Rossmann wrote:
I would suggest adding optional source/destination encoding parameters to the functions, eg: utf8_encode(string $string, string $source_encoding = "ISO-8859-1") utf8_decode(string $string, string $destination_encoding = "ISO-8859-1")
That's an interesting idea, and definitely worth considering. In the much longer term, we could make the parameter mandatory rather than deprecating the entire function. As you say, the challenge is how to implement the other encodings / what to do if ext/mbstring is not installed. It would be very tempting to support Windows-1252 directly, because it's just a few characters on top of the existing mappings, and is so commonly mistaken for ISO-8859-1. Anything else could then perhaps give a run-time error if ext/mbstring wasn't found. On 22/12/2021 00:31, Kris Craig wrote:
Now might be a good time to make this into an RFC. :)
I have a draft kicking around with a lot of analysis of current usage. I will try to pick it back up after Christmas. Regards, -- Rowan Tommins [IMSoP]

Thread (40 messages)

« previous php.internals (#116713) next »