On 22/03/2021 16:52, Aleksander Machniak wrote:
On 22.03.2021 16:41, Rowan Tommins wrote:
That code will never do anything useful.
I already proved it is useful, regardless of it's name/intention.
You have proven no such thing. If that function is saving you from
errors, it is completely by accident.
The same effect can be achieved using base64_encode() and
base64_decode(), or bin2hex() and hex2bin(), or any other function that
takes a series of bytes and applies an arbitrary encoding to it.
It could also be achieved by using a binary column type in the database,
because the values you have stored are not useful as strings; they might
as well be encrypted.
Given the sequence of bytes "\xE3\x82\zB0", which is a valid UTF-8
string representing U+30B0 KATAKANA LETTER GU グ calling utf8_encode()
will result in the sequence of bytes "\xC3\xA3\xC2\x82\xC2\xB0", which
is the UTF-8 representation of the following Unicode code points:
- U+00E3 LATIN SMALL LETTER A WITH TILDE ã
- U+0082 CONTROL: BREAK PERMITTED HERE
- U+00B0 DEGREE SIGN °
This is clearly gibberish, and bears no relationship to the original
string; it is what is generally referred to as "mojibake".
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php